Using C# XElement to parse a XML Response

Posted by Subhen on Stack Overflow See other posts from Stack Overflow or by Subhen
Published on 2010-03-22T07:18:41Z Indexed on 2010/03/22 7:21 UTC
Read the original article Hit count: 376

Filed under:
|
|
|

Here is my XML Response:

 <DIDL-Lite
xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/" 
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/"
<item id="1182" parentID="40" restricted="1">
<title>Hot Issue</title>
</item>
</DIDL-Lite>

When I am trying to parse it using xELemnt and try assigning to a var like below:

   var vnyData = from xmyResponse in xResponse.Descendants("DIDL-Lite").Elements("item")
select new myClass
                                     {strTitle = ((string)xmyResponse .Element("title")).Trim()};

This is not yeilding any results.

Thanks, Subhendu

© Stack Overflow or respective owner

Related posts about c#

Related posts about Xml