





|
JAXML :
- JAXML is a Python module which makes the automated generation of XML, XHTML or HTML documents easy.
- JAXML is part of the official Debian GNU/Linux distribution.
- If we believe our logs, it seems to be used internally by companies and universities worldwide : Boeing , Philips , Sanofi , and many others... Please tell us if you use it.
- Documents generated with JAXML are still easily human readable.
- Here are two samples of automated XML document generation, the first one with the classical
file objects, the second one using JAXML :
# --- Classical Version
fp = open("sample.xml", "w")
fp.write('<?xml version="1.0" encoding="iso-8859-1"?>\n')
fp.write('<sometag someattr="1">\n')
fp.write(' <anothertag jaxml="Nice">\n')
fp.write(' <thirdone>Yo</thirdone>\n')
fp.write(' </anothertag>\n')
fp.write('</sometag>\n')
fp.close()
# an equivalent version using JAXML
import jaxml
doc = jaxml.XML_document()
doc.sometag(someattr=1).anothertag(jaxml="Nice")
doc.thirdone("Yo")
doc._output("sample.xml")
# Both produce the same output
<?xml version="1.0" encoding="iso-8859-1"?>
<sometag someattr="1">
<anothertag jaxml="Nice">
<thirdone>Yo</thirdone>
</anothertag>
</sometag>
As you may see above, JAXML takes care of the most annoying things for you :
* closing tags
* indentation to maintain human readability
But more than that JAXML gives you some interesting possibilities :
* full support of xml namespaces since version 3.0
* a base class which takes care of all sorts of tagged documents
* add or multiply documents
* output to file objects, strings, file names
* special constructs or shortcuts dedicated to HTML or CGI output
* Two different templating facilities
* And many more...
- To learn more, just Download it !
|