Android XML.parse() not finding content:encoded tag

xenlong2

New Member
I'm using Android's XML parsing helper (\[code\]android.util.Xml.parse(InputStream, Encoding, ContentHandler\[/code\]) to parse this RSS feed: http://www.rssweather.com/wx/nz/christchurch/rss.php. It doesn't seem to recognise the \[code\]content:encoded\[/code\] tag, which contains the data I am trying to retrieve. Here is the structure of the XML:\[code\]<rss> <channel> <item> <title>...</title> <pubDate>...</pubDate> // Other tags <content:encoded> <![CDATA[ (.... this is what I want to retrieve ...) ]]> </content:encoded> </item> </channel></rsss>\[/code\]This is my code:\[code\]void parse(){ RootElement root = new RootElement("rss"); Element channel = root.getChild("channel"); Element item = channel.getChild("item"); Element contentEncoded = item.getChild("content", "encoded"); // Have also tried these two: Element encoded = item.getChild("encoded"); Element content = item.getChild("content"); contentEncoded.setEndTextElementListener(new EndTextElementListener() { public void end(String body) { Log.d("Test", "Content found: " + body); } }); try { Xml.parse(feedUrl.openConnection().getInputStream(), Xml.Encoding.UTF_8, root.getContentHandler()); } catch (Exception e){ throw new RuntimeException(e); }}\[/code\]Where have I gone wrong? :) I can retrieve the other data from the \[code\]<item>\[/code\] element such as the title or pubDate without trouble; it's only the content:encoded that eludes me.
 
Back
Top