{"id":97,"date":"2008-10-19T10:09:00","date_gmt":"2008-10-19T10:09:00","guid":{"rendered":"https:\/\/wdev-blog.azurewebsites.net\/index.php\/2008\/10\/19\/linq-over-xml\/"},"modified":"2008-10-19T10:09:00","modified_gmt":"2008-10-19T10:09:00","slug":"linq-over-xml","status":"publish","type":"post","link":"http:\/\/panahy.nl\/index.php\/2008\/10\/19\/linq-over-xml\/","title":{"rendered":"LINQ over XML"},"content":{"rendered":"<p>This example is also from th AppDev:<\/p>\n<pre style=\"font-size : 8pt;\"><br \/>var doc = CreateDocument(); \/\/ returns an XDocument<br \/>var items = from item in doc.Descendants(\"Item\")<br \/>            where (string)item.Parent.Attribute(\"Name\") == \"Breads\"<br \/>            select item;<br \/><br \/><\/pre>\n<p>now transforming the xml to a  new format:<\/p>\n<pre style=\"font-size : 8pt;\"><br \/>XElement transformed = new XElement(\"items\",<br \/>            from item in items<br \/>            select new XElement(\"item\",<br \/>                   new XAttribute(\"ItemName\", (string)item.Element(\"Name\")),<br \/>                   new XAttribute(\"Price\", (string)item.Element(\"Price))));<br \/><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This example is also from th AppDev: var doc = CreateDocument(); \/\/ returns an XDocumentvar items = from item in doc.Descendants(&#8220;Item&#8221;) where (string)item.Parent.Attribute(&#8220;Name&#8221;) == &#8220;Breads&#8221; select item; now transforming the xml to a new format: XElement transformed = new XElement(&#8220;items&#8221;, from item in items select new XElement(&#8220;item&#8221;, new XAttribute(&#8220;ItemName&#8221;, (string)item.Element(&#8220;Name&#8221;)), new XAttribute(&#8220;Price&#8221;, (string)item.Element(&#8220;Price))));<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[33,29],"tags":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"post-thumbnail":false},"uagb_author_info":{"display_name":"Pouya Panahy","author_link":"http:\/\/panahy.nl\/index.php\/author\/pouya\/"},"uagb_comment_info":0,"uagb_excerpt":"This example is also from th AppDev: var doc = CreateDocument(); \/\/ returns an XDocumentvar items = from item in doc.Descendants(\"Item\") where (string)item.Parent.Attribute(\"Name\") == \"Breads\" select item; now transforming the xml to a new format: XElement transformed = new XElement(\"items\", from item in items select new XElement(\"item\", new XAttribute(\"ItemName\", (string)item.Element(\"Name\")), new XAttribute(\"Price\", (string)item.Element(\"Price))));","_links":{"self":[{"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/posts\/97"}],"collection":[{"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/comments?post=97"}],"version-history":[{"count":0,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/posts\/97\/revisions"}],"wp:attachment":[{"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/media?parent=97"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/categories?post=97"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/tags?post=97"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}