Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set encoding of XML using Jaxb properties

I configured my web service client to use Moxy to marshall / unmarshall the service payloads. My service client does not have a control on the Jaxb configuration. That said, I have configured my client to use Moxy by adding a jaxb.properties file with the entry as follows::

javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory

I have a requirement to change the encoding of the payload so that its::

<?xml version="1.0" encoding="windows-1252"?>

Is this possible by adding an entry to jaxb.properties (as it would be a lot of work for me to inject this value via code, due to the various frameworks we have in place).

like image 767
Damo Avatar asked Jan 09 '14 10:01

Damo


1 Answers

Encoding for MOXy and all JAXB implementations is controlled by the JAXB_ENCODING property set on the Marshaller.

  • http://blog.bdoughan.com/2011/08/jaxb-and-java-io-files-streams-readers.html
like image 129
bdoughan Avatar answered Sep 29 '22 21:09

bdoughan