Browse Source

Repect StaxDriver in XStreamMarshaller::marshalXmlStreamWriter

This commit makes sure that namespaces configured via the streamDriver
property are respected.
pull/27722/head
qxo 7 years ago committed by Arjen Poutsma
parent
commit
247d2bb0ae
  1. 8
      spring-oxm/src/main/java/org/springframework/oxm/xstream/XStreamMarshaller.java

8
spring-oxm/src/main/java/org/springframework/oxm/xstream/XStreamMarshaller.java

@ -694,7 +694,13 @@ public class XStreamMarshaller extends AbstractMarshaller implements BeanClassLo @@ -694,7 +694,13 @@ public class XStreamMarshaller extends AbstractMarshaller implements BeanClassLo
@Override
protected void marshalXmlStreamWriter(Object graph, XMLStreamWriter streamWriter) throws XmlMappingException {
try {
doMarshal(graph, new StaxWriter(new QNameMap(), streamWriter, this.nameCoder), null);
final StaxWriter writer;
if( streamDriver instanceof StaxDriver){
writer = ((StaxDriver)streamDriver).createStaxWriter(streamWriter);
}else{
writer = new StaxWriter( new QNameMap(),streamWriter, this.nameCoder);
}
doMarshal(graph,writer, null);
}
catch (XMLStreamException ex) {
throw convertXStreamException(ex, true);

Loading…
Cancel
Save