Code example for DefaultHandler

0
 
    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 \"http://127.234.172.38:7845/bar\"><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 =
            "<!DOCTYPE foo ["