如何在Java中将Badgerfish风格的JSON转换为XML? [英] How to convert Badgerfish style JSON to XML in Java?
问题描述
标签和属性非常重要,因此我使用Badgerfish约定。
这适用于使用 xmljson 的Python,但是我找不到像样的体面包来做到这一点。 GSON似乎没有Badgerfish的实施。 这个主题不提供任何标签/属性保留包,主题也有点老旧。
哪些Java包可以将JSON转换为XML,同时将标签/属性放在正确的位置?
对Badgerfish以外的其他方法的建议也值得欢迎......
非常感谢!
您可以使用XPath 3.1
json-to-xml()
函数,然后执行XSLT将生成的XML转换为您需要的格式。 My Java application takes XML input, and parses it using the simpleframework. I want it to accept JSON as well, therefore I want to convert the JSON to XML.
Tags and attributes are important, therefore I use the Badgerfish convention. This works well in Python with xmljson, but I can't find a decent package to do this. GSON doesn't seem to have a Badgerfish implementation. This topic doesn't provide any tag/attribute retaining packages, the topic is a bit old as well.
Which Java packages can do the conversion from JSON to XML while putting tags/attributes at the right place?
Suggestions for alternative methods than Badgerfish are welcome as well...
Many thanks in advance!
You can use the XPath 3.1 json-to-xml()
function, and then do an XSLT transformation on the generated XML to get it into the format you require.
这篇关于如何在Java中将Badgerfish风格的JSON转换为XML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!