reading XSD from file using eclipse-mdt-xsd

40 views Asked by At

I'm trying to use the MSD-XSD library for parsing XSD files, but I can't figure out how to create an XSDSchema object from an XSD file, and if there's a way to also read the xs:include files, etc.

1

There are 1 answers

0
ModdyFire On

I found a way to do it. Not sure if this is the easiest way.

    DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
    docFactory.setNamespaceAware(true);
    DocumentBuilder builder = factory.newDocumentBuilder();
    InputSource is = new InputSource(new FileReader(file));
    Document doc = builder.parse(is);
    XSDSchema xsd = XSDSchemaImpl.createSchema(doc.getFirstChild());