Jeremy Kloth added the comment:

This really is not a bug, but more of a (common) misunderstanding of how the 
mixing of namespace-aware (createElementNS) and namespace-ignorant 
(createElement) methods work.

>From DOM3 Core 
>[http://www.w3.org/TR/DOM-Level-3-Core/core.html#Namespaces-Considerations]:

  Elements and attributes created by the DOM Level 1 methods do not
  have a namespace prefix, namespace URI or local name.

DOM4 updates this to say that the namespace URI and prefix are null if not 
explicitly given at creation.

To use your example, adding a Chimp-element to the existing document is really:

<?xml version="1.0" encoding="utf-8"?>
<Zoo xmlns='http://foo.bar/zoo'>
  <Compound><Chimp/><Chimp xmlns=""/></Compound>
</Zoo>

The fact that serializing and re-parsing it works is really a bug in the 
serializing code not honoring the null-namespace.

So in short, always use create*NS() methods when dealing with namespace-aware 
XML (like XPath).

----------
nosy: +jkloth

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18182>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to