开发者

JAXB Namespace Order

开发者 https://www.devze.com 2023-01-21 03:16 出处:网络
Is it possible to control the order of namespaces in documents generated via JAXB? I know, it is not relevant to XML standards, but somehow we need to generate namespace declarations in specific order

Is it possible to control the order of namespaces in documents generated via JAXB? I know, it is not relevant to XML standards, but somehow we need to generate namespace declarations in specific order? For example, currently we have generated

<rootelement a="http://www.example.com/xom" b="http://www.example.com/crops">
..
</rootelement>

But I need:

开发者_高级运维<rootelement b="http://www.example.com/crops" a="http://www.example.com/xom">
..
</rootelement>


JAXB does not directly supports that, but you can marshal your object to ContentHandler, XMLStreamWriter or XMLEventWriter and take care of the namespace and attribute ordering in there.

0

精彩评论

暂无评论...
验证码 换一张
取 消