Author jkloth
Recipients Alexander.Tobias.Heinrich, jkloth
Date 2013-06-10.18:07:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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 []:

  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=''>
  <Compound><Chimp/><Chimp xmlns=""/></Compound>

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).
Date User Action Args
2013-06-10 18:07:27jklothsetrecipients: + jkloth, Alexander.Tobias.Heinrich
2013-06-10 18:07:27jklothsetmessageid: <>
2013-06-10 18:07:27jklothlinkissue18182 messages
2013-06-10 18:07:27jklothcreate