Is there any API to generate XSD programmatically in java. I need to generate XSD from Json-Schema ,I will read Json Schema and based on the elements i encounter during parsing need to create appropriate XSD elements. So if there is any API that can XSD elements it would help me in development process.
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
I've used API's such as XSOM and Xerces XML Schema to parse XSD's, but their API's don't offer methods to programmatically generate XSD's. (I suppose you could try to access their internal implementations to somehow generate an XSD, but that would be at your own risk and probably ill-advised.)
However, since an XSD is an XML document itself, you could use something like DOM through JAXP to programmatically create an XSD:
Which would create a mySchema.xsd that looks like this:
Which could be used for an XML file such as:
I've never worked with JSON Schema, but I suppose as you parse the JSON or iterate through your JSON data structure, you could sort out the logic to do something like the above example.