You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by "Vinh Nguyen (vinguye2)" <vi...@cisco.com> on 2006/11/09 18:05:06 UTC

XmlObject getDomNode fails to preserve namespace prefix

Hi all,
There seems to be an issue with the getDomNode() method in the generated
beans in that it fails to preserve the namespace prefix.  I would expect
the method to preserve all xml artifacts of the existing object, but it
doesn't seem to be.  On the other hand, the newDomNode() method does
preserve the prefix.  What is the proper way for getting the original
xml node representation of the object, without having to create a new
node?
 
For example, my BoxDocument and BoxType classes were generated from an
xsd.  Here's the various xml test outputs:
 
**XML from boxDoc.xmlText():
<box:Box
xmlns:box="http://demo/schemas/box"><box:width>123</box:width><box:heigh
t>123</box:height></box:Box>

**XML from boxDoc.getDomNode():
<?xml version="1.0" encoding="UTF-8"?>
<Box xmlns="http://demo/schemas/box">
    <width>123</width>
    <height>123</height>
</Box>
 
**XML from boxDoc.newDomNode():
<?xml version="1.0" encoding="UTF-8"?>
<box:Box xmlns:box="http://demo/schemas/box">
    <box:width>123</box:width>
    <box:height>123</box:height>
</box:Box>

Any help is appreciated, thanks!
-Vinh