使用 Jaxb 属性设置 XML 的编码 [英] Set encoding of XML using Jaxb properties
问题描述
我将我的 Web 服务客户端配置为使用 Moxy
来 marshall/unmarshall
服务负载.我的服务客户端无法控制 Jaxb 配置
.也就是说,我已经通过添加一个 jaxb.properties
文件将我的客户端配置为使用 Moxy
,该文件的条目如下::
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"?>
这是否可以通过向 jaxb.properties
添加一个条目来实现(因为我们有各种框架,通过代码注入这个值对我来说需要做很多工作).
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).
推荐答案
MOXy 和所有 JAXB 实现的编码由 Marshaller
上设置的 JAXB_ENCODING
属性控制.
Encoding for MOXy and all JAXB implementations is controlled by the JAXB_ENCODING
property set on the Marshaller
.
这篇关于使用 Jaxb 属性设置 XML 的编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!