
January 31st, 2012, 02:31 AM
|
|
Contributing User
|
|
Join Date: Feb 2004
Posts: 378
Time spent in forums: 5 Days 14 h 38 sec
Reputation Power: 10
|
|
|
C# : Problem reading RDF XML tags
Apologies!
Wrong issue!
I'm trying to read the
<item><title>
<item><link>
<item><Description>
from this XML (portion provided)
Code:
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:prism="http://purl.org/rss/1.0/modules/prism/" xmlns:admin="http://webns.net/mvcb/">
.
.
.
<item rdf:about="http://geology.gsapubs.org/cgi/content/abstract/40/2/99?rss=1">
<title><![CDATA[Tectonic subsidence of the Lomonosov Ridge]]></title>
<link>http://geology.gsapubs.org/cgi/content/abstract/40/2/99?rss=1</link>
<description>
<![CDATA[
<p>The Cenozoic sedimentary record revealed by the uplift followed by rapid subsidence to the deep-water environment observed on the Lomonosov Ridge today.</p>
]]>
</description>
</item>
but cannot using
Code:
XmlDocument xDoc = new XmlDocument();
HttpWebRequest rssFeed = (HttpWebRequest)WebRequest.Create(incomingURL);
xDoc.Load(rssFeed.GetResponse().GetResponseStream());
XmlNodeList _items = xDoc.GetElementsByTagName("item");
foreach...
{
string text = xNode.SelectSingleNode("title").InnerText;
}
--I've tried adding a NamespaceManager but still no joy...since it's not prefixed with rdf: do I need a namespace manager ?
I have all the <item> nodes in a nodelist so that works - so I cannot grasp why I cannot take the title, link, description from them ?
Ben
Last edited by amstel_za : January 31st, 2012 at 05:12 AM.
|