I have an Object that is being marshalled to XML using JAXB. One element contains a String that includes quotes (\"). The resulting XML has "
where t
The simplest way, when using sun's Marshaller implementation is to provide your own implementation of the CharacterEscapeEncoder which does not escape anything.
Marshaller m = jcb.createMarshaller();
m.setProperty(
"com.sun.xml.bind.marshaller.CharacterEscapeHandler",
new NullCharacterEscapeHandler());
With
public class NullCharacterEscapeHandler implements CharacterEscapeHandler {
public NullCharacterEscapeHandler() {
super();
}
public void escape(char[] ch, int start, int length, boolean isAttVal, Writer writer) throws IOException {
writer.write( ch, start, length );
}
}