Java / XSD Parsing

I doubt that there is something like this, but I decided to ask: Does anyone know if there is a Java library that reads the xsd file and "creates" certain elements, for example. in String format for use in code?
For example. read in the following diagram:

<?xml version="1.0" encoding="utf-8"?> <xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="Address"> <xs:complexType> <xs:sequence> <xs:element name="Street" type="xs:string" /> <xs:element name="Town" type="xs:string" /> <xs:element name="Country" type="xs:string" minOccurs="0" /> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> 

And have a string in the following format:

 <Address> <Street></Street> <Town></Town> <Country></Country> </Address> 

Automated tools do something similar, that is, they analyze WSDL and from the type section create, for example, JAXB classes, which can be instances of elements defined in the scheme.
Is there a library for this?

UPDATE:
For example, in Eclipse, when creating an xml descriptor for a web application, it presents a tree table with all the necessary elements for users to fill in according to the scheme. How do they do it? I guess they analyze the xsds included in banks. Any input is greatly appreciated.
Thanks!

+8
java dom xml xsd jaxp
source share
2 answers

If this is the WSDL file with which you want to generate Java classes, then Axis WSDL2Java (based on JAXB) can be used to get classes based on the schema defined in WSDL.

JAXB also offers a binding structure that you might want to find.

http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/twbs_jaxbschema2java.html

The above link should be helpful.

+1
source share

oXygen has an XML instance generator that can generate a set of sample XML documents based on this XML schema.

You can also call it from the command line .

+1
source share

Source: https://habr.com/ru/post/650294/


All Articles