karl <karl+pythonb...@la-grange.net> added the comment: This following markup creates the mistake as described earlier in the comments
<element xmlns=""> <b class="foo" alt=""/> </element> This markup doesn't <element xmlns="bla"> <b class="foo" alt=""/> </element> It returns <?xml version="1.0" ?><element xmlns="bla"> <b alt="" class="foo"/> </element> When using this markup <element bar=""> <b class="foo" alt=""/> </element> It outputs the right markup, <?xml version="1.0" ?><element bar=""> <b alt="" class="foo"/> </element> So the mistake occurs really when xmlns="". I have checked and the following markup is a conformant markup according to the XML specification so xmlns="" or bar="" are conformant on the root element. <element xmlns=""> <b class="foo" alt=""/> </element> XML Namespaces are defined in another specification. http://www.w3.org/TR/REC-xml-names/. In the section of Namespaces default http://www.w3.org/TR/REC-xml-names/#defaulting, The specification is clear. "The attribute value in a default namespace declaration MAY be empty. This has the same effect, within the scope of the declaration, of there being no default namespace." the proposed "if data:" earlier in the comment solves the issue. I have attached a unit testcase as required by Mark Lawrence (BreamoreBoy) ---------- keywords: +patch nosy: +karlcow Added file: http://bugs.python.org/file19239/test-minidom-xmlns.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5762> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com