I have an object, generated by XJC, called Product. I want to set product.currentPrice (a String) to be £210 where £ is the currency symbol (passed in from elsewhere in the system).
Trouble is, JAXB is escaping my ampersand, so it produces £210 instead. How do I make it not do this?
By default, the marshaller implementation of the JAXB usually escapes characters. To change this default behavior you will have to Write a class that implements the
com.sun.xml.bind.marshaller.CharacterEscapeHandlerinterface.set that handler in the Marshaller
You can have a look at samples provided with JAXB, character escaping sample