Code example for XMLReader

Methods: setContentHandlersetDTDHandlersetEntityResolversetErrorHandler

0
 
    /** 
     * Initializes the reader for this parser. 
     */ 
    private void initialize() { 
        reader.setContentHandler(this);
        reader.setDTDHandler(this);
        reader.setEntityResolver(this);
        reader.setErrorHandler(this);
    } 
     
    @Override 
    public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
 
        /* Always set the qualified name to lower case */ 
        qName = qName.toLowerCase();
 
        /* Check if the root node has been created yet */ 
        if(rootNode == null) {
            currentNode = rootNode = new XMLNode(qName);
Experience pair programming with AI  Get Codota for Java