  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Tomcat - JSP/Servlet container | | Struts - A MVC web framework | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | JSP - A mailing list about Java Server Pages specification and reference | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | |
Struts & Hibernate
|
|
|
  | | | Subject: getChildren problem | Subject: getChildren problem 2007-09-26 - By zongo46@(protected)
Back 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 (See http://UTF-8.ora-code.com)"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs= "http://www.w3.org/2000/01/rdf-schema#" xmlns:dc="http://purl.org/dc/elements/1 .1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:prism="http://prismstandard .org/namespaces/1.2/basic/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns="http: //www.connotea.org/2005/01/schema#"> <Post rdf:about="A_URL"> <!-- more elements here --> </Post> </rdf:RDF>
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 = parser.build(new 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: http://www.gmx.net/de/go/multimessenger __ ____ ____ ____ ____ ____ ____ ____ ____ ____ To control your jdom-interest membership: http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)
|
|
 |