Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » XmlParser and <![CDATA[
XmlParser and <![CDATA[ [message #21260] Mon, 11 May 2009 03:24 Go to previous message
iksobert is currently offline  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();
}

 
Read Message
Read Message
Read Message
Previous Topic: Proposal: add Vector::InsertPick(int i, pick_ T&)
Next Topic: date filter bug?
Goto Forum:
  


Current Time: Thu May 16 12:47:33 CEST 2024

Total time taken to generate the page: 0.02378 seconds