Code example for Schema

Methods: newValidator

0
        dbf.setSchema(schema);
 
        builder = dbf.newDocumentBuilder();
        builder.setErrorHandler(handler);
        builder.setEntityResolver(handler);
        validator = schema.newValidator();
    } 
 
    @Override 
    protected void tearDown() throws Exception { 
        builder = null;
        validator = null;
        super.tearDown(); 
    } 
 
    public void testParserBadXML() { 
        System.out.println("-- testParserBadXML");
        try { 
            builder.parse(getAsStream(BAD_XML));
            assertTrue(true);