Hello, I'm having an issue using Linq to XML parsing the following XML. What I am doing is getting the element checking if it's what I want, then moving to the next. I am pretty sure it has to do with the xmlns, but I need this code to work with both this style and normal style RSS feeds (no xmlns). Any ideas?
<?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:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/">
<channel rdf:about="http://someurl.com">
<title>sometitle</title>
XElement currentLocation = startElementParameter;
foreach (string x in ("channel\\Title").Split('\\'))
{
if (condition1 == false)
{
continue;
}
else if (condition2 == false)
{
break;
}
else
{
// This is returning null.
currentLocation = currentLocation.Element(x);
}
}
Thanks!
EDIT: XML didn't paste right.