Code example for DefaultHandler

    private DefaultHandler offline;
    protected void setUp() throws Exception { 
        parser = SAXParserFactory.newInstance().newSAXParser();
        offline = new OfflineContentHandler(new DefaultHandler());
    public void testExternalDTD() throws Exception { 
        String xml =
            "<!DOCTYPE foo SYSTEM \"\"><foo/>"; 
        try { 
            parser.parse(new InputSource(new StringReader(xml)), offline);
        } catch (ConnectException e) {
            fail("Parser tried to access the external DTD:" + e);
    public void testExternalEntity() throws Exception { 
        String xml =
Contextual code suggestions in your IDE  Get Codota for Java