The namespace fixup algorithm used by the LSSerializer [1] (see the 
paragraph starting with "Namespaces are fixed up during serialization 
...") is the same one which is used by Document.normalizeDocument().

[1] 
http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407/load-save.html#LS-LSSerializer

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [EMAIL PROTECTED]
E-mail: [EMAIL PROTECTED]

Stanimir Stamenkov <[EMAIL PROTECTED]> wrote on 01/08/2007 08:12:15 AM:

> /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]


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

Reply via email to