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 =
Stop searching for code, let great code find you!  Add Codota to your java IDE