Code example for RootElement

Methods: getChildgetContentHandler

0
        } 
    } 
 
    public List<Tea> parse() {
        final Tea curTea = new Tea();
        RootElement root = new RootElement(ROOT_ELEMENT);
        final List<Tea> teas = new ArrayList<Tea>();
 
        Element tea = root.getChild(TEA);
        tea.setEndElementListener(new EndElementListener(){
            public void end() { 
                teas.add(curTea.copy());
            } 
        }); 
        tea.getChild(NAME).setEndTextElementListener(new EndTextElementListener(){
            public void end(String body) {
                curTea.setName(body);
            } 
        }); 
        tea.getChild(GROUP).setEndTextElementListener(new EndTextElementListener(){
            public void end(String body) {
                curTea.setGroup(body);
            } 
        }); 
        tea.getChild(IMAGE_FILE_NAME).setEndTextElementListener(new EndTextElementListener(){
            public void end(String body) {
                curTea.setImageFileName(body);
            } 
        }); 
        tea.getChild(DESCRIPTION).setEndTextElementListener(new EndTextElementListener(){
            public void end(String body) {
                curTea.setDescription(body);
            } 
        }); 
 
        try { 
            Xml.parse(this.getInputStream(), Xml.Encoding.UTF_8, root.getContentHandler());
        } catch (Exception e) {
            throw new RuntimeException(e);
        } 
        return teas;
    } 
Connect your IDE to all the code out there  Get Codota for Java