moving a node values in linq to xml C#



I am trying get the email value under author node in C#. But nothing is coming. My Code is=



XDocument xDoc = XDocument.Parse("myxml");
var foos = from xelem in xDoc.Descendants("author")
select xelem;


XML which i am using is -



<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://ift.tt/r5ut6F" xmlns:batch="http://ift.tt/1fDpyew"

xmlns:gContact="http://ift.tt/1paXJ1i" xmlns:gd="http://ift.tt/17PKlnd"

xmlns:openSearch="http://ift.tt/13zUF5b">
<id>yogeshcs2003@gmail.com</id>
<updated>2015-02-09T04:03:31.220Z</updated>
<category scheme="http://ift.tt/qkaDoc" term="http://ift.tt/1aAtS8N"/>
<title type="text">Yogesh Adhikari's Contacts</title>
<link rel="alternate" type="text/html" href="https://www.google.com/"/>
<link rel="next" type="application/atom+xml" href="http://ift.tt/1zzH8uh

results=1&amp;start-index=2"/>
<author>
<name>Yogesh Adhikari</name>
<email>yogeshcs2003@gmail.com</email>
</author>
<generator version="1.0" uri="http://ift.tt/1nyhtxs">Contacts</generator>
<openSearch:totalResults>3099</openSearch:totalResults>
<openSearch:startIndex>1</openSearch:startIndex>
<openSearch:itemsPerPage>1</openSearch:itemsPerPage>
</feed>


Can someone point out what is wrong? Thanks


No comments:

Post a Comment