0
我從Gmail中的XML提要內。因而提取屬性值:使用LINQ to XML - 如何元素
<feed version="0.3">
<title>Gmail - Inbox for [email protected]</title>
<tagline>New messages in your Gmail Inbox</tagline>
<fullcount>9</fullcount>
<link rel="alternate" href="http://mail.google.com/mail" type="text/html"/>
<modified>2012-07-19T02:43:55Z</modified>
<entry>
<title>$50 or $100 Nightly Resort Credit and Room Upgrade</title>
<summary>Add to Address Book | Update email address Marriott® FIND A HOTEL EXPLORE PLAN MARRIOTT REWARDS</summary>
<link rel="alternate" href="http://.google.com" type="text/html"/><modified>2012-07-19T01:23:00Z</modified>
<issued>2012-07-19T01:23:00Z</issued>
<id>tag:gmail.google.com,2004:1407882080256681207</id>
<author>
<name>Marriott</name>
<email>[email protected]</email>
</author>
</entry>
<entry>
<title>Tim Anderson's ITWriting » Blog Archive Resort » Moving a database from on-premise SQL Server to SQL Azure: some hassle</title>
<summary>Tim Anderson's ITWriting Tech writing blog Home Articles Reviews Gadget Writing Forthcoming</summary>
<link rel="alternate" href="http://google.comen" type="text/html"/><modified>2012-07-19T00:55:25Z</modified>
<issued>2012-07-19T00:55:25Z</issued>
<id>tag:gmail.google.com,2004:1407880344364808586</id>
<author>
<name>me</name>
<email>[email protected]</email>
</author>
</entry>
我創建了一個LinqPad查詢這樣:
XDocument xmlDoc = XDocument.Load(@"C:\Users\Brad Agee\Documents\feeds.xml");
var q = from c in xmlDoc.Descendants("entry")
where c.Element("title").Value.ToLower().Contains("resort")
select new {
name = c.Element("title").Value,
url = ??,
email ??
};
q.Dump();
我怎樣才能提取link
標籤href
屬性爲url
屬性的值和email
屬性的值到email
屬性?
如此簡單,當你看到它... – blub 2012-07-19 14:19:46
謝謝您幫幫我! – blub 2012-07-19 14:20:26