Code example for SAXParser: Parsing XML documents

Methods: parse

0
    } 
 
    @Override 
    public List<Book> parseInternal(InputStream is) throws Exception {
 
        this.parser.parse(is, this.saxHandler);
        return this.saxHandler.catalog;
    } 
 
    private class SAXHandler extends DefaultHandler {
 
        private List<Book> catalog;
        private Book book;
 
        private String currentElementValue;
 
        @Override 
        public void startDocument() throws SAXException { 
            this.catalog = new ArrayList<Book>();
            this.book = null;
            super.startDocument();