Code example for Schema

Methods: newValidator

        // This may throw a SAX Exception if the schema itself is not a valid XSD 
        Schema schema = factory.newSchema(new StreamSource(xsdStream));
        Validator validator = schema == null ? null : schema.newValidator();
        return validator;
     * Takes an XML document as a string as parameter and returns a DOM for it. 
     * On error, returns null and prints a (hopefully) useful message on the monitor. 
    protected Document getDocument(InputStream xml, ITaskMonitor monitor) {
        try { 
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();