Martin v. Löwis sagte: > Derek Basch wrote: > >[...] >> How do I get minidom to NOT render an empty script element? Should I submit >> a bug report? > > That said, I think there is a simple solution: add an empty Text node to the > script element: > > script_node_0.appendChild(doc.createText(u"")) > > [Disclaimer: this is untested; from reading the source, I think it should > work]
If this doesn't work, you might want to try XIST (http://www.livinglogic.de/Python/xist) instead of minidom. XIST knows that the script element is not EMPTY, and when the output is in HTML compatible XML an end tag will be produced: >> from ll.xist.ns import html >>> print html.script(type="text/javascript", src="../test.js").asBytes(xhtml=1) <script src="../test.js" type="text/javascript"></script> Using pure XML mode gives: >>> print html.script(type="text/javascript", src="../test.js").asBytes(xhtml=2) <script src="../test.js" type="text/javascript"/> Bye, Walter Dörwald _______________________________________________ XML-SIG maillist - XML-SIG@python.org http://mail.python.org/mailman/listinfo/xml-sig