Hi,
I am trying to use XMLSerializer to write XML document to a file. In the
result I get xmlns:xsi attribute twice. I used it before and I think it was
working ok before. I downloaded latest xerces jars. Any ideas?
Java code:
DOMParser parser = new DOMParser();
parser.parse("file:///d:\\tc\\xml\\test_schema.xml");
Document doc = parser.getDocument();
OutputFormat outputFormat = new OutputFormat(doc);
outputFormat.setIndenting(true);
XMLSerializer serializer = new XMLSerializer(System.out,
outputFormat);
serializer.serialize(doc);
XML Document:
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="D:\tc\xml\test.xsd">
<node1 attr1="cvirko">
<node11/>
<node12/>
</node1>
<node2>
<node21/>
<node22/>
</node2>
</root>
Result after serialization:
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="D:\tc\xmlparadise\xml\test.xsd">
<node1 attr1="cvirko">
<node11/>
<node12/>
</node1>
<node2>
<node21/>
<node22/>
</node2>
</root>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]