Code example for XMLReader

Methods: parse, setContentHandler, setDTDHandler, setEntityResolver

0
     * @param r an XMLReaderInstance 
     * @exception IOException if an error occured while reading the document. 
     */ 
    public Document createDocument(String ns, String root, String uri,
                                   XMLReader r) throws IOException {
        r.setContentHandler(this);
        r.setDTDHandler(this);
        r.setEntityResolver(this);
        try { 
            r.parse(uri);
        } catch (SAXException e) {
            Exception ex = e.getException();
            if (ex != null && ex instanceof InterruptedIOException) {
                throw (InterruptedIOException) ex;
            } 
            throw new SAXIOException(e);
        } 
        currentNode = null;
        Document ret = document;
        document = null;
        return ret;