Code example for SAXParser

Methods: getXMLReadersetProperty

        XMLReader xmlReader;
        try { 
            SAXParser parser = parserFactory.newSAXParser();
            // Validation is against XML Schema 
            xmlReader = parser.getXMLReader();
        } catch (Exception e) {
            throw new RuntimeException(e);
        xmlReader.setEntityResolver(new AppSchemaEntityResolver());
        // We principally care about the failures themselves, but it is also possible to install a 
        // ContentHandler to output annotated XML that identifies the precise location of failures. 
        // That can be done with a serializer that implements both ContentHandler and ErrorHandler. 
        // It should be installed here (and used for the error handler): 
        // parser.setContentHandler(contentHandler); 
        xmlReader.setErrorHandler(new AppSchemaValidatorErrorHandler());
        try { 
            xmlReader.parse(new InputSource(input));