How do I prevent a pair of XMLEvent[Reader|Writer] from splitting empty tags into start+end tags?
- by java.is.for.desktop
Hello, everyone!
I have an understanding problem of how the following code works:
XMLInputFactory xif = XMLInputFactory.newFactory();
XMLOutputFactory xof = XMLOutputFactory.newFactory();
XMLEventReader reader = xif.createXMLEventReader(/* ... */);
XMLEventWriter writer = xof.createXMLEventWriter(/* ... */);
writer.add(reader);
The method writer.add([some reader]) reads all events from reader and writes them consequently. Sadly, following happens:
The input
<root><c/></root>
gets transformed to
<root><c><c/></root>
I know, from XML point of view, these are equal trees, but not for a human ;)
What can I do to get the same output?
FYI: I need a XMLEvent[Reader|Writer] pair later to filter "XML events".