Home » U++ Library support » U++ Core » XmlParser and <![CDATA[
XmlParser and <![CDATA[ [message #21260] |
Mon, 11 May 2009 03:24 |
iksobert
Messages: 6 Registered: August 2007
|
Promising Member |
|
|
I haven't quite been able to figure this one out. I tried parsing some XML from an RSS feed, but it seems that the Parser discards any CDATA that it finds. Calling XmlNode::GetText() returns an empty string, and AsXml(XmlNode) returns the xml as an empty tag. Am I doing something wrong?
Here is simple snippet I made to demonstrate this:
#include "rssy.h"
#include <Web/Web.h>
rssy::rssy()
{
CtrlLayout(*this, "No CDATA!");
list.AddColumn("Text");
list.AddColumn("XML");
get_feeds();
}
void rssy::get_feeds(void)
{
String out;
HttpClient client;
client.URL("http://losangeles.craigslist.org/search/jjj?query=php&format=rss");
out=client.ExecuteRedirect();
XmlNode n = ParseXML(out);
const XmlNode &channel=n[0];
int j;
int tag;
for(int i=channel.FindTag("item");i<channel.GetCount();i++) {
if(channel[i].GetTag()!="item") continue;
const XmlNode &item=channel[i];
tag=item.FindTag("title");
if(tag==-1) continue;
const XmlNode &title=item[tag];
j=list.GetCount()+1;
list.SetCount(j);
list.Set(j-1,0,title[0].GetText());
list.Set(j-1,1,AsXML(item));
}
}
GUI_APP_MAIN
{
rssy().Run();
}
|
|
|
|
|
Goto Forum:
Current Time: Mon Apr 29 19:39:55 CEST 2024
Total time taken to generate the page: 0.01813 seconds
|