Hi,

It seems to me that there is a problem in XMLWriter regarding the
serialization of XML with namespaces.

The following code:
----------------------------------------------------------------------
import org.dom4j.*;
import org.dom4j.io.*;

public class Main
{
    public static void main( String[] args ) throws Exception {
        Document dom = DocumentHelper.createDocument();
        
        Element root = dom.addElement("root","ns1");
        Element child1 = root.addElement("joe","ns2");
        child1.addElement("zot","ns1");
        
        XMLWriter writer = new XMLWriter(
            System.out,
            OutputFormat.createPrettyPrint() );
        writer.write(dom);
    }
}
----------------------------------------------------------------------

produces the following output:
----------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns="ns1">
  <joe xmlns="ns2">
    <zot/>
  </joe>
</root>
----------------------------------------------------------------------

although it should produce:
----------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns="ns1">
  <joe xmlns="ns2">
    <zot xmlns="ns1"/>
  </joe>
</root>
----------------------------------------------------------------------


I'm using dom4j version 1.0.  Is this a known problem? or am I missing
something?

regards,
----------------------
K.Kawaguchi
E-Mail: [EMAIL PROTECTED]


_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to