Consider this example -
I have a class called Report that has a field of type Message. The Message class has a field called \"body\" which is a string. \"body\" can
If its only for Marshalling, and to ignore the < and >, We can use the following:
marshaller.setProperty("com.sun.xml.bind.marshaller.CharacterEscapeHandler",
new CharacterEscapeHandler() {
@Override
public void escape(char[] ac, int i, int j, boolean flag,
Writer writer) throws IOException {
writer.write(ac, i, j);
}
});