< prev index next >
jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/MarshallerImpl.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -163,11 +163,11 @@
write(obj, createWriter(out), new StAXPostInitAction(inscopeNamespace,serializer));
}
@Override
public void marshal(Object obj, XMLStreamWriter writer) throws JAXBException {
- write(obj, XMLStreamWriterOutput.create(writer,context), new StAXPostInitAction(writer,serializer));
+ write(obj, XMLStreamWriterOutput.create(writer,context, escapeHandler), new StAXPostInitAction(writer,serializer));
}
@Override
public void marshal(Object obj, XMLEventWriter writer) throws JAXBException {
write(obj, new XMLEventWriterOutput(writer), new StAXPostInitAction(writer,serializer));
@@ -369,10 +369,19 @@
serializer.endDocument();
serializer.reconcileID(); // extra check
}
+ /**
+ * Returns escape handler provided with JAXB context parameters.
+ *
+ * @return escape handler
+ */
+ CharacterEscapeHandler getEscapeHandler() {
+ return escapeHandler;
+ }
+
//
//
// create XMLWriter by specifing various type of output.
//
//
@@ -434,17 +443,18 @@
// so no point in doing a buffering here.
if(encoding.equals("UTF-8")) {
Encoded[] table = context.getUTF8NameTable();
final UTF8XmlOutput out;
+ CharacterEscapeHandler ceh = createEscapeHandler(encoding);
if(isFormattedOutput())
- out = new IndentingUTF8XmlOutput(os, indent, table, escapeHandler);
+ out = new IndentingUTF8XmlOutput(os, indent, table, ceh);
else {
if(c14nSupport)
- out = new C14nXmlOutput(os, table, context.c14nSupport, escapeHandler);
+ out = new C14nXmlOutput(os, table, context.c14nSupport, ceh);
else
- out = new UTF8XmlOutput(os, table, escapeHandler);
+ out = new UTF8XmlOutput(os, table, ceh);
}
if(header!=null)
out.setHeader(header);
return out;
}
< prev index next >