Code example for SAXParser: Parsing XML documents

Methods: getXMLReaderparse

            verifyException(e, "No such file or directory");
        // And then with dummy resolver; should work ok now 
        sp = spf.newSAXParser();
        sp.getXMLReader().setEntityResolver(new MyResolver("   "));
        h = new DefaultHandler();
        try { 
            sp.parse(new InputSource(new StringReader(XML)), h);
        } catch (SAXException e) {
            fail("Should not have failed with entity resolver, got ("+e.getClass()+"): "+e.getMessage());
    // Helper classes 
Connect your IDE to all the code out there  Get Codota for Java