Code example for DocumentBuilder

Methods: parse, setEntityResolver, setErrorHandler

0
                                                   "validating parser" ) 
                                .initCause( e );
        } 
 
        /* Configure the parser. */ 
        parser.setEntityResolver( NodeEntityResolver.getInstance() );
        if ( ehandler != null ) {
            parser.setErrorHandler( ehandler );
        } 
 
        /* Do the parse. */ 
        InputStream strm = getDataSource().getInputStream();
        Document doc = parser.parse( strm );
        strm.close();
 
        /* Return the resulting document as a source. */ 
        return new DOMSource( doc, datsrc.getSystemId() );
    } 
 
    /** 
     * Convenience method to get a DOM from this document, which either