Is there a Java API to parse an XSD schema file?
I found XSOM, but it doesn't seem to be maintained anymore.
With the desired XML document opened in the active editor tab, choose Tools | XML Actions | Generate XSD Schema from XML File on the main menu. The Generate Schema From Instance Document dialog box opens. and select the desired file in the dialog that opens.
xsd file that maps XML elements and attributes to objects and properties. You can use this code to help you create XML blocks using typed code, and to deserialize and serialize data from REST API requests and responses.
Using standard JDK 6:
System.setProperty(DOMImplementationRegistry.PROPERTY, "com.sun.org.apache.xerces.internal.dom.DOMXSImplementationSourceImpl");
DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
com.sun.org.apache.xerces.internal.impl.xs.XSImplementationImpl impl = (XSImplementationImpl) registry.getDOMImplementation("XS-Loader");
XSLoader schemaLoader = impl.createXSLoader(null);
XSModel model = schemaLoader.loadURI("src/test/resources/my.xsd");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With