Problem serializing processing instruction with LSSerializer
Joined: Apr 04, 2009
I'm facing a problem while using the DOM 3 Load-Save API's LSSerializer to serialize a DOM Document. The Document contains 2 processing instructions and a document element with child nodes. But when it's serialized, the second processing instruction <?metadataRepository?> appears after the document element in output file. Details are below. Please advise what I'm doing wrong.
Sun JRE 1.6.0_07
Using the internal Xerces API shipped with JRE
What the code does is:
1. Load the file WellFormedSmallSample.xml using Documentbuilder.parse() to get a Document.
2. Save this Document back to another file TestLSOutput.xml using DOM 3 LSSerializer
Input file WellFormedSmallSample.xml:
The output file contains <?metadataRepository?> processing instruction after <repository> element. How do I correct this?