adworldmedia
asked on
Parse XML in Linq C#
I've been trying to use the Linq to XML XDocument and Descendants to parse the following XML results; but I'm not having any luck....
I want to be able to extract the ClickURL as well as the title and description...
Any help would be appreciated!!!
I want to be able to extract the ClickURL as well as the title and description...
Any help would be appreciated!!!
<?xml version="1.0" encoding="UTF-8" ?>
- <Results xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://dtd.overture.com/schema/affiliate/2.9.3/OvertureSearchResults.xsd">
- <ResultSet id="searchResults" numResults="4" adultRating="X">
- <Listing rank="1" title="Women Photo Personals" description="1000s of Women Flirting. Connect with Local Women!" siteHost="bookofmatches.com" adultRating="X">
<ClickUrl type="body">http://0.r.msn.com/</ClickUrl>
</Listing>
- <Listing rank="2" title="Free Porn Sites" description="Don't spend money on porn! Find a huge list of free porn sites here." siteHost="FreePornJerk.com" adultRating="X">
<ClickUrl type="body">http://0.r.msn.com/</ClickUrl>
</Listing>
- <Listing rank="3" title="No Strings Sex" description="Seeking a One Night Stand? Find People & Hook Up for No Strings Sex." siteHost="NoStringsSex.com" adultRating="X">
<ClickUrl type="body">http://0.r.msn.com/</ClickUrl>
</Listing>
- <Listing rank="4" title="Meet for Sex" description="Looking for Naughty Fun? Meet Hot Locals for Sex!" siteHost="SexMatch.com" adultRating="X">
<ClickUrl type="body">http://0.r.msn.com/</ClickUrl>
</Listing>
<NextArgs>Keywords=sex&xargs=12KPjg1oZ&hData=12KPjg1o1g4MeKx8rccb%2D8OZeKwi</NextArgs>
</ResultSet>
</Results>
P.S.
An encoded ampersand should look like:
An encoded ampersand should look like:
&
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Fascinating. Load() didn't like the ampersands, but Parse() seems to be OK with them.
You're going to have problems using XDocument and such with that document because you have some un-encoded ampersands in the data. For example: