Set encoding of XML using Jaxb properties

2020-03-18 17:24发布

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).

1条回答
干净又极端
2楼-- · 2020-03-18 18:07

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

查看更多
登录 后发表回答