Java Mailing List Archive

Home » Home (12/2007) » JDOM User »

[jdom-interest] getChildren problem



hello together,
I got a strange problem with getChildren(). i get the following xml inputstream by a http GET request:

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="" xmlns:rdfs="" xmlns:dc="" xmlns:dcterms="" xmlns:prism="" xmlns:foaf="" xmlns="">

<Post rdf:about="A_URL">
 <!-- more elements here -->


my sendRequest() method returns the above xml as a String. From that String I build a Document:

String in = sendRequest();
SAXBuilder parser = new SAXBuilder();
Document doc = InputSource(new StringReader(in)));

Then I search for the child "Post" of the root element:

List posts = doc.getRootElement().getChildren("Post");
System.out.println(posts.size()); // output: 0

There is no child "Post"? I think there should be. I tested the following:

List posts = doc.getRootElement().getChildren();
Element el = (Element)posts.get(0);
System.out.println(el.getName()); // output: Post

The first output says there is no child post of the root element, the second output says that the first child of root element is named "Post". What's wrong here?

Thank you in advance! -P-
Psssst! Schon vom neuen GMX MultiMessenger geh?rt?
Der kanns mit allen:
To control your jdom-interest membership:
©2008 - Jax Systems, LLC, U.S.A.