Parsing xml with dom4j or jdom or anyhow

Posted by c0mrade on Stack Overflow See other posts from Stack Overflow or by c0mrade
Published on 2010-05-13T14:48:16Z Indexed on 2010/05/13 15:24 UTC
Read the original article Hit count: 339

Filed under:
|
|
|
|

Hello, I wanna read feed entries and I'm just stuck now. Take this for example : http://stackoverflow.com/feeds/question/2084883 lets say I wanna read all the summary node value inside each entry node in document. How do I do that? I've changed many variations of code this one is closest to what I want to achieve I think :

Element entryPoint = document.getRootElement();
        Element elem;
        for(Iterator iter = entryPoint.elements().iterator(); iter.hasNext();){
            elem = (Element)iter.next();
                    System.out.println(elem.getName());
        }

It goes trough all nodes in xml file and writes their name. Now what I wanted to do next is

if(elem.getName() == "entry")

to get only the entry nodes, how do I get elements of the entry nodes, and how to get let say summary and its value? tnx

© Stack Overflow or respective owner

Related posts about java

Related posts about Xml