public static void validate(final String xsdFilename, final InputSource is, final ParserOptions options)
        throws Exception
    {
        final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        final SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);

        factory.setSchema(schemaFactory.newSchema(new File(xsdFilename)));
        factory.setNamespaceAware(true);

        if (options.xIncludeAware())
        {
            factory.setXIncludeAware(true);
            factory.setFeature("http://apache.org/xml/features/xinclude/fixup-base-uris", false);
        }

        factory.newDocumentBuilder().parse(is);
    }
Validate the document against a given schema. Errors will be written to {@link java.lang.System#err}.

@param xsdFilename schema to validate against.
@param is          source from which schema is read. Ideally it will have the systemId property set to resolve
                   relative references.
@param options     to be applied during parsing.
@throws Exception if an error occurs when parsing the document or schema.
sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/XmlSchemaParser.java