我的xml文档如下:
<entry gd:kind="asdf#person" xmlns="http://portablecontacts.net/ns/1.0" xmlns:gd="http://schemas.google.com/g/2005">
<id>103854838474573576376</id>
<displayName>garden au</displayName>
<profileUrl>http://www.google.com/profiles/dddd</profileUrl>
<thumbnailUrl>http://www.google.com/friendconnect/scs/images/NoPictureDark65.jpg</thumbnailUrl>
<emails>
<value>[email protected]</value>
<type />
<primary>true</primary>
</emails>
<emails>
<value>[email protected]</value>
<type />
<primary>false</primary>
</emails>
<urls>
<value>http://picasaweb.google.com/4545245</value>
</urls>
<urls>
<value>http://www.google.com/profiles/45252525</value>
<type>profile</type>
</urls>
<urls>
<value>https://www.googleapis.com/buzz/v1/people/442225/@self?alt=atom</value>
<type>atom</type>
</urls>
</entry>
我想查询出[email protected]的值,求一段linqtoxml语句
<entry gd:kind="asdf#person" xmlns="http://portablecontacts.net/ns/1.0" xmlns:gd="http://schemas.google.com/g/2005">
<id>103854838474573576376</id>
<displayName>garden au</displayName>
<profileUrl>http://www.google.com/profiles/dddd</profileUrl>
<thumbnailUrl>http://www.google.com/friendconnect/scs/images/NoPictureDark65.jpg</thumbnailUrl>
<emails>
<value>[email protected]</value>
<type />
<primary>true</primary>
</emails>
<emails>
<value>[email protected]</value>
<type />
<primary>false</primary>
</emails>
<urls>
<value>http://picasaweb.google.com/4545245</value>
</urls>
<urls>
<value>http://www.google.com/profiles/45252525</value>
<type>profile</type>
</urls>
<urls>
<value>https://www.googleapis.com/buzz/v1/people/442225/@self?alt=atom</value>
<type>atom</type>
</urls>
</entry>
我想查询出[email protected]的值,求一段linqtoxml语句
XElement xelement3 = XElement.Load(xmlData3);
XNamespace ns = "http://portablecontacts.net/ns/1.0";
var query = from node in xelement3.Descendants(ns + "emails")
select node.Element(ns + "value").Value;
foreach (var email in query.ToList())
Console.WriteLine(email);