Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Jajcus/pyxmpp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacek Konieczny <jajcus@jajcus.net>2004-12-29 21:18:11 +0300
committerJacek Konieczny <jajcus@jajcus.net>2004-12-29 21:18:11 +0300
commitaffb008d13cd7ea482cd32558fcbefe361c0ecc6 (patch)
treed7ad5fbe8742b747e1029f50078b098426bb7aeb /auxtools
parentb90dd9b6d2ab1def49504ebbdee16e4f1cb96712 (diff)
- web pages automation
Diffstat (limited to 'auxtools')
-rwxr-xr-xauxtools/htmlmerge.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/auxtools/htmlmerge.py b/auxtools/htmlmerge.py
new file mode 100755
index 0000000..925d9ef
--- /dev/null
+++ b/auxtools/htmlmerge.py
@@ -0,0 +1,27 @@
+#!/usr/bin/python
+
+import libxml2
+import sys
+
+
+class Merger:
+ def __init__(self,template_file,content_file):
+ self.template_doc=libxml2.parseFile(template_file)
+ self.content_doc=libxml2.parseFile(content_file)
+ def merge(self):
+ output_doc=self.template_doc.copyDoc(True)
+ slot=output_doc.xpathEval('//*[@id="main"]')[0]
+ content=self.content_doc.xpathEval('//*[@class="document"]/*')
+ for node in content:
+ print >>sys.stderr,"------"
+ print >>sys.stderr,"node ns: ",node.ns().getContent()
+ print >>sys.stderr,"slot ns: ",slot.ns().getContent()
+ print >>sys.stderr,node.serialize()
+ print >>sys.stderr,"------"
+ nn=slot.addChild(node.copyNode(True))
+ output_doc.getRootElement().reconciliateNs(output_doc)
+ return output_doc
+
+m=Merger(sys.argv[1],sys.argv[2])
+out=m.merge()
+print out.serialize(format=True)