Is there a tool to generate a JSON schema from an XML schema through Java?

前端 未结 5 985
滥情空心
滥情空心 2020-12-14 08:20

Is anyone aware of a tool or approach from which we can generate a JSON schema from XML schema or XML schema from JSON schema by Java?

5条回答
  •  Happy的楠姐
    2020-12-14 09:02

    Converting XML to JSON is quite easy and can be done various ways:

    http://answers.oreilly.com/topic/278-how-to-convert-xml-to-json-in-java
    http://www.json.org/javadoc/org/json/XML.html#toJSONObject%28java.lang.String%29

    For converting from XML to JSON look at this maybe, seems to be very simple:

    http://www.bramstein.com/projects/xsltjson/
    http://code.google.com/p/xml2json-xslt/
    http://json-lib.sourceforge.net/index.html

    There is also http://x-stream.github.io/ library which allows you to make conversion in both sides (also to POJOs). Simple example usage you can find here: Convert XML to JSON format

    /edit: ups, looks like I didn't understood question correctly :P

提交回复
热议问题