/Igor Lobanov/:

<ns1:root xmlns:ns1="urn:ns1">
  <ns2:child xmlns:ns2="urn:ns2"/>
  <ns2:child xmlns:ns2="urn:ns2"/>
</ns1:root>

I guess the above result is because of specific normalization / optimization algorithm - the serialization would need to look ahead which might not be always possible to produce the form you want. I don't know if the namespace normalization algorithm [1] for the DOM Level 3 Document.normalizeDocument() is any different, too. You would notice descendant elements of <ns2:child> which are in the same namespace won't get 'xmlns:ns2' attribute.

You could always add the namespace declaration attribute yourself:

    root.setAttributeNS("http://www.w3.org/2000/xmlns/";,
                        "xmlns:ns2", "urn:ns2");

[1] http://www.w3.org/TR/DOM-Level-3-Core/namespaces-algorithms.html#normalizeDocumentAlgo

--
Stanimir

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to