Reputation: 3067
I'm trying to parse complex XML file with JSoup, hovewer when getting XML like this:
<feed xmlns="http://www" xmlns:y="http://" xmlns:thr="http:">
<id>5</id>
<title>List of friends posts</title>
<updated>2014-01-13T18:36:06Z</updated>
<entry>
<text>ttt</text>
</entry>
<entry>
<text>aaa</text>
</entry>
</feed>
It doesn't see "entry" subtree, just like there is none. Code:
doc3 = Jsoup.parse(doc2.toString(), "", Parser.xmlParser());
Elements feed = doc3.select("feed entry");
Upvotes: 0
Views: 280
Reputation: 123
This seems to work:
String xml = "<feed xmlns=\"http://www\" xmlns:y=\"http://\" xmlns:thr=\"http:\">"
+"<id>5</id>"
+"<title>List of friends posts</title>"
+"<updated>2014-01-13T18:36:06Z</updated>"
+"<entry>"
+" <text>ttt</text>"
+"</entry>"
+"<entry>"
+" <text>aaa</text>"
+"</entry>"
+"</feed>";
Document doc = Jsoup.parse(xml);
Elements feed = doc.select("feed entry");
Upvotes: 1