xml-commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Glavassevich <mrgla...@ca.ibm.com>
Subject Re: importNode missing namespace
Date Fri, 13 Mar 2009 04:33:44 GMT
Richard <wrongch@gmail.com> wrote on 03/13/2009 12:20:42 AM:

> Hi, I got such problem with importNode, when try to import a Node
> from one Document into another.
>
> DocumentA
> <?xml version='1.0' encoding='utf-8'?><m:root xmlns:m='TEST'><m:
> s>TEST</m:s></m:root>
> DocumentB:
> <?xml version='1.0' encoding='utf-8' ?><n:root xmlns:n='TEST'><n:
> t>TEST</n:t></n:root>
>
> I try to import m:s in DocumentA into DocumentB, and replace n:t Node
>
> expected:
> <?xml version='1.0' encoding='utf-8' ?><n:root xmlns:n='TEST'><n:
> s>TEST</n:s></n:root>
>
> but the result was:
> <?xml version='1.0' encoding='utf-8' ?><n:root xmlns:n='TEST'><m:
> s>TEST</m:s></n:root>
>
> Can somebody tell me why?

You've left out all sorts of details, but you're probably not using a
namespace-aware or namespace fixing serializer when you serialize the
document. DOM Level 3's LSSerializer would write [1] this out correctly.

Thanks.

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

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org
Mime
View raw message