{"id":2459,"date":"2013-03-02T01:49:06","date_gmt":"2013-03-02T01:49:06","guid":{"rendered":"http:\/\/enjoyasp.net\/?p=2459"},"modified":"2013-03-02T01:49:06","modified_gmt":"2013-03-02T01:49:06","slug":"linq-to-xml","status":"publish","type":"post","link":"https:\/\/enjoyasp.net\/index.php\/2013\/03\/02\/linq-to-xml\/","title":{"rendered":"linq to xml"},"content":{"rendered":"<div>\n<div>\n\t\t&nbsp; XDocument xdoc = XDocument.Load(@&quot;XMLFile1.xml&quot;);<\/div>\n<div>\n\t\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var product = from u in xdoc.Descendants(&quot;product&quot;)<\/div>\n<div>\n\t\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; where u.Parent.Attribute(&quot;urlKeyWords&quot;).Value.IndexOf(&quot;postpar&quot;) &gt;= 0<\/div>\n<div>\n\t\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; select u;<\/div>\n<div>\n\t\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach (var u in product)<\/div>\n<div>\n\t\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<\/div>\n<div>\n\t\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string name = u.Attribute(&quot;text&quot;).Value;<\/div>\n<div>\n\t\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.WriteLine(name);<\/div>\n<div>\n\t\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<\/div>\n<div>\n\t\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.Read();<\/div>\n<p>\t&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;<\/p><\/div>\n<div>\n\t&lt;Products&gt;<\/div>\n<div>\n\t&lt;WebSite urlKeyWords=&quot;postpartum&quot;&gt;<\/div>\n<div>\n\t&lt;product text=&quot;dd&quot; value=&quot;dd&quot; amount =&quot;1000&quot;&gt;&lt;\/product&gt;<\/div>\n<div>\n\t&lt;product text=&quot;dd1&quot; value=&quot;dd1&quot; amount =&quot;2000&quot;&gt;&lt;\/product&gt;<\/div>\n<div>\n\t&lt;product text=&quot;dd2&quot; value=&quot;dd2&quot; amount =&quot;3000&quot;&gt;&lt;\/product&gt;<\/div>\n<div>\n\t&lt;product text=&quot;dd3&quot; value=&quot;dd3&quot; amount =&quot;4000&quot;&gt;&lt;\/product&gt;<\/div>\n<div>\n\t&lt;\/WebSite&gt;<\/div>\n<div>\n\t&lt;WebSite urlKeyWords=&quot;aaaaaa&quot;&gt;<\/div>\n<div>\n\t&lt;product text=&quot;aa&quot; value=&quot;aa&quot; amount =&quot;11&quot;&gt;&lt;\/product&gt;<\/div>\n<div>\n\t&lt;product text=&quot;aa2&quot; value=&quot;aa2&quot; amount =&quot;112&quot;&gt;&lt;\/product&gt;<\/div>\n<div>\n\t&lt;product text=&quot;aa3&quot; value=&quot;aa3&quot; amount =&quot;113&quot;&gt;&lt;\/product&gt;<\/div>\n<div>\n\t&nbsp;<\/div>\n<div>\n\t&lt;\/WebSite&gt;<\/div>\n<div>\n\t&lt;WebSite urlKeyWords=&quot;bbbbbb&quot;&gt;<\/div>\n<div>\n\t&lt;product text=&quot;bbbb&quot; value=&quot;bbbb&quot; amount =&quot;22&quot;&gt;&lt;\/product&gt;<\/div>\n<div>\n\t&lt;product text=&quot;bbbb22&quot; value=&quot;bbbb22&quot; amount =&quot;2222&quot;&gt;&lt;\/product&gt;<\/div>\n<div>\n\t&lt;\/WebSite&gt;<\/div>\n<div>\n\t&lt;\/Products&gt;<\/div>\n<div>\n\t&nbsp;<\/div>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; XDocument xdoc = XDocument.Load(@&quot;XMLFile1. [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35],"tags":[],"class_list":["post-2459","post","type-post","status-publish","format-standard","hentry","category-aspdotnet"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts\/2459","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/comments?post=2459"}],"version-history":[{"count":0,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts\/2459\/revisions"}],"wp:attachment":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/media?parent=2459"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/categories?post=2459"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/tags?post=2459"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}