Preserve comments when using JibxMarshaller

Prior to this commit, JibxMarshaller used a SAX ContentHandler to
marshal to StAX XMLEventWriters, which inadvertently resulted in the
deletion of XML comments.

After this commit, JibxMarshaller adapts the XMLEventWriter into an
XMLStreamWriter and comments are preserved.

Issue: SPR-9768
This commit is contained in:
Arjen Poutsma
2012-09-14 09:48:25 +02:00
committed by Chris Beams
parent 17c6515c0a
commit f191a55b8f
4 changed files with 18 additions and 9 deletions

View File

@@ -338,8 +338,8 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe
@Override
protected void marshalXmlEventWriter(Object graph, XMLEventWriter eventWriter) {
ContentHandler contentHandler = StaxUtils.createContentHandler(eventWriter);
marshalSaxHandlers(graph, contentHandler, null);
XMLStreamWriter streamWriter = StaxUtils.createEventStreamWriter(eventWriter);
marshalXmlStreamWriter(graph, streamWriter);
}