﻿{"id":68,"date":"2009-03-02T00:11:04","date_gmt":"2009-03-01T22:11:04","guid":{"rendered":"http:\/\/www.idwaikat.me\/?p=68"},"modified":"2009-07-14T00:34:42","modified_gmt":"2009-07-13T22:34:42","slug":"linq-to-xml","status":"publish","type":"post","link":"http:\/\/www.idwaikat.me\/?p=68","title":{"rendered":"LINQ To XML"},"content":{"rendered":"<p><strong>Language Integrated Query<\/strong> (<strong>LINQ<\/strong>, pronounced &#8220;<em>link<\/em>&#8220;) is a Microsoft .NET Framework component that adds native data querying capabilities to .NET languages.(<a href=\"http:\/\/en.wikipedia.org\/wiki\/Language_Integrated_Query\" target=\"_blank\">#<\/a>)<\/p>\n<p>LINQ to XML is a built-in LINQ data provider that is implemented within the &#8220;System.Xml.Linq&#8221; namespace in .NET 3.5.<\/p>\n<p>As Microsoft says, LINQ to XML provides a clean programming model that enables you to read, construct and write XML data.  LINQ to XML can be used to perform LINQ queries over XML to retrieve from your local server or from a remote HTTP URL or web-service, or from any in-memory XML content.<\/p>\n<p>They says that LINQ to XML provides much richer (and easier) querying and data shaping support than the low-level XmlReader\/XmlWriter API in .NET.  It also ends up being much more efficient (and uses much less memory) than the DOM API that XmlDocument provides.<\/p>\n<p>Today I will give a simple example that uses LINQ to XML (VB.NET and C#)<!--more--><\/p>\n<p>First we create new ASP.NET 3.5 website using Visual Studio 2008 or any IDE that supports ASP.NET 3.5.<\/p>\n<p>Then we will create XML file, we assumed that the file contains info about websites, lets say, website name and website link (url), website node contains <em>lang <\/em>attribute, which contains the language of the site, also we can add it as a node if we want,  the XML file appears as follows:<\/p>\n<blockquote>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\">&lt;?<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: #a31515;\">xml<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\"> <\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: red;\">version<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\">=<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">&#8220;<span style=\"color: blue;\">1.0<\/span>&#8220;<span style=\"color: blue;\"> <\/span><span style=\"color: red;\">encoding<\/span><span style=\"color: blue;\">=<\/span>&#8220;<span style=\"color: blue;\">utf-8<\/span>&#8220;<span style=\"color: blue;\"> ?&gt;<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\"> &lt;<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: #a31515;\">Websites<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\">&gt;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\"> &lt;<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: #a31515;\">Website<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\"> <\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: red;\">lang<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\">=<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">&#8220;<span style=\"color: blue;\">en<\/span>&#8220;<span style=\"color: blue;\">&gt;<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\"> &lt;<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: #a31515;\">Name<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\">&gt;<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">Ibrahim Dwaikat<span style=\"color: blue;\">&lt;\/<\/span><span style=\"color: #a31515;\">Name<\/span><span style=\"color: blue;\">&gt;<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\"> &lt;<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: #a31515;\">Url<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\">&gt;<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">http:\/\/www.idwaikat.me<span style=\"color: blue;\">&lt;\/<\/span><span style=\"color: #a31515;\">Url<\/span><span style=\"color: blue;\">&gt;<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\"> &lt;\/<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: #a31515;\">Website<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\">&gt;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\"> &lt;<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: #a31515;\">Website<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\"> <\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: red;\">lang<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\">=<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">&#8220;<span style=\"color: blue;\">en<\/span>&#8220;<span style=\"color: blue;\">&gt;<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\"> &lt;<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: #a31515;\">Name<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\">&gt;<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">Yahoo<span style=\"color: blue;\">&lt;\/<\/span><span style=\"color: #a31515;\">Name<\/span><span style=\"color: blue;\">&gt;<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\"> &lt;<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: #a31515;\">Url<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\">&gt;<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">http:\/\/www.Yahoo.com<span style=\"color: blue;\">&lt;\/<\/span><span style=\"color: #a31515;\">Url<\/span><span style=\"color: blue;\">&gt;<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\"> &lt;\/<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: #a31515;\">Website<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\">&gt;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\"> &lt;<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: #a31515;\">Website<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\"> <\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: red;\">lang<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\">=<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">&#8220;<span style=\"color: blue;\">ar<\/span>&#8220;<span style=\"color: blue;\">&gt;<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\"> &lt;<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: #a31515;\">Name<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\">&gt;<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">Balata-Albalad<span style=\"color: blue;\">&lt;\/<\/span><span style=\"color: #a31515;\">Name<\/span><span style=\"color: blue;\">&gt;<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\"> &lt;<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: #a31515;\">Url<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\">&gt;<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">http:\/\/www.balata-albalad.org<span style=\"color: blue;\">&lt;\/<\/span><span style=\"color: #a31515;\">Url<\/span><span style=\"color: blue;\">&gt;<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\"> &lt;\/<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: #a31515;\">Website<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\">&gt;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\"> &lt;<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: #a31515;\">Website<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\"> <\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: red;\">lang<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\">=<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">&#8220;<span style=\"color: blue;\">ar<\/span>&#8220;<span style=\"color: blue;\">&gt;<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\"> &lt;<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: #a31515;\">Name<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\">&gt;<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">Google Jordan<span style=\"color: blue;\">&lt;\/<\/span><span style=\"color: #a31515;\">Name<\/span><span style=\"color: blue;\">&gt;<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\"> &lt;<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: #a31515;\">Url<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\">&gt;<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">http:\/\/www.google.jo<span style=\"color: blue;\">&lt;\/<\/span><span style=\"color: #a31515;\">Url<\/span><span style=\"color: blue;\">&gt;<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\"> &lt;\/<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: #a31515;\">Website<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\">&gt; <\/span><\/p>\n<p class=\"MsoNormal\" style=\"text-align: left; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; line-height: 115%; font-family: &quot;Courier New&quot;; color: blue;\">&lt;\/<\/span><span style=\"font-size: 10pt; line-height: 115%; font-family: &quot;Courier New&quot;; color: #a31515;\">Websites<\/span><span style=\"font-size: 10pt; line-height: 115%; font-family: &quot;Courier New&quot;; color: blue;\">&gt;<\/span><\/p>\n<\/blockquote>\n<blockquote><\/blockquote>\n<p>I think the XML clearify itself &#8230; no need for more details about its schema.<\/p>\n<p>Now we save the XML in the <em>root <\/em>folder of our website, named : <em>XMLFile.xml<\/em><\/p>\n<p>In <em>Page_Load <\/em>we write the following code (VB.NET) &#8211; after a moments I will write C# code too, very similar,<\/p>\n<blockquote>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> <span style=\"color: blue;\">Protected<\/span> <span style=\"color: blue;\">Sub<\/span> Page_Load(<span style=\"color: blue;\">ByVal<\/span> sender <span style=\"color: blue;\">As<\/span> <span style=\"color: blue;\">Object<\/span>, <span style=\"color: blue;\">ByVal<\/span> e <span style=\"color: blue;\">As<\/span> System.EventArgs) <span style=\"color: blue;\">Handles<\/span> <span style=\"color: blue;\">Me<\/span>.Load<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> <span style=\"color: blue;\">Dim<\/span> xmlDoc <span style=\"color: blue;\">As<\/span> XDocument = XDocument.Load(Server.MapPath(<span style=\"color: #a31515;\">&#8220;XMLFile.xml&#8221;<\/span>))<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> <\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> <span style=\"color: blue;\">Dim<\/span> xmlData = <span style=\"color: blue;\">From<\/span> webSite <span style=\"color: blue;\">In<\/span> xmlDoc.Descendants(<span style=\"color: #a31515;\">&#8220;Website&#8221;<\/span>) _<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> <span style=\"color: blue;\">Where<\/span> (webSite.Attribute(<span style=\"color: #a31515;\">&#8220;lang&#8221;<\/span>).Value = <span style=\"color: #a31515;\">&#8220;ar&#8221;<\/span>) _<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> <span style=\"color: blue;\">Select<\/span> Name = webSite.Element(<span style=\"color: #a31515;\">&#8220;Name&#8221;<\/span>).Value, _<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> Url = webSite.Element(<span style=\"color: #a31515;\">&#8220;Url&#8221;<\/span>).Value<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> <\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> <span style=\"color: blue;\">For<\/span> <span style=\"color: blue;\">Each<\/span> item <span style=\"color: blue;\">In<\/span> xmlData<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> Response.Write(<span style=\"color: #a31515;\">&#8220;&lt;a href='&#8221;<\/span> &amp; item.Url &amp; <span style=\"color: #a31515;\">&#8220;&#8216;&gt;&#8221;<\/span> &amp; item.Name &amp; <span style=\"color: #a31515;\">&#8220;&lt;\/a&gt; &lt;br \/&gt;&#8221;<\/span>)<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> <span style=\"color: blue;\">Next<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\"> <\/span><\/p>\n<p class=\"MsoNormal\" style=\"text-align: left; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; line-height: 115%; font-family: &quot;Courier New&quot;;\"> <span style=\"color: blue;\">End<\/span> <span style=\"color: blue;\">Sub<\/span><\/span><\/p>\n<\/blockquote>\n<p class=\"MsoNormal\" style=\"text-align: left; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\">\n<p class=\"MsoNormal\" style=\"text-align: left; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\">Now I will talk about the code line by line.<\/p>\n<blockquote>\n<p class=\"MsoNormal\" style=\"text-align: left; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><span style=\"color: blue;\">Dim<\/span> xmlDoc <span style=\"color: blue;\">As<\/span> XDocument = XDocument.Load(Server.MapPath(<span style=\"color: #a31515;\">&#8220;XMLFile.xml&#8221;<\/span>))<\/span><\/p>\n<\/blockquote>\n<p class=\"MsoNormal\" style=\"text-align: left; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\">Here I created an instance form XDocument (which belongs to System.XML.Linq namespace), and using the method load, I loaded the previous XML file which named <em>XMLFile.XML<\/em>, here I used Server.MapPath helper method which returns the correct path of the XML file, because sometimes when we didn&#8217;t use it, the relative path can be not as we expected.<\/p>\n<p class=\"MsoNormal\" style=\"text-align: left; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\">\n<p class=\"MsoNormal\" style=\"text-align: left; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\">The next step is making a query that returns Website Name and URL, the condition is that the language is Arabic (ar).<\/p>\n<blockquote>\n<p class=\"MsoNormal\" style=\"text-align: left; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><span style=\"color: blue;\">Dim<\/span> xmlData = <span style=\"color: blue;\">From<\/span> webSite <span style=\"color: blue;\">In<\/span> xmlDoc.Descendants(<span style=\"color: #a31515;\">&#8220;Website&#8221;<\/span>) _<\/span><\/p>\n<\/blockquote>\n<p class=\"MsoNormal\" style=\"text-align: left; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\">we define a variable (generic collection, typeless here) that will contain the query result (xmlData), and we start the Linq by the keyword: <em>From<\/em>, followed by <em>XElement <\/em>which is here <em>website<\/em>, followed by In <em>xDocument.Descendants<\/em>, which takesSystem.XML.Linq.XName, and returns a filtered collection of the descendant elements for this document or element in document order, only elements that have a matching System.XML.Linq.XName are included in the returned collection.<\/p>\n<blockquote>\n<p class=\"MsoNormal\" style=\"text-align: left; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><span style=\"color: blue;\">Where<\/span> (webSite.Attribute(<span style=\"color: #a31515;\">&#8220;lang&#8221;<\/span>).Value = <span style=\"color: #a31515;\">&#8220;ar&#8221;<\/span>) _<\/span><\/p>\n<\/blockquote>\n<p class=\"MsoNormal\" style=\"text-align: left; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">Where represents the condition, linq condition supports many comparisons like =, &lt;&gt;, is, IsNot &#8230; etc.<br \/>\n<\/span><\/p>\n<p class=\"MsoNormal\" style=\"text-align: left; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\">\n<blockquote>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> <span style=\"color: blue;\">Select<\/span> Name = webSite.Element(<span style=\"color: #a31515;\">&#8220;Name&#8221;<\/span>).Value, _<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> Url = webSite.Element(<span style=\"color: #a31515;\">&#8220;Url&#8221;<\/span>).Value<\/span><\/p>\n<\/blockquote>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\">\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">Here we specify what the query will return, we will return the Name, and the URL, if you know the basics of DOM API in .NET its easier to understand the meaning of this.<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\">\n<blockquote>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><span style=\"color: blue;\">For<\/span> <span style=\"color: blue;\">Each<\/span> item <span style=\"color: blue;\">In<\/span> xmlData<\/span><\/p>\n<\/blockquote>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">now we make a For Each loop to get the records in the xmlData collection.<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\">\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">Response.Write(<span style=\"color: #a31515;\">&#8220;&lt;a href='&#8221;<\/span> &amp; item.Url &amp; <span style=\"color: #a31515;\">&#8220;&#8216;&gt;&#8221;<\/span> &amp; item.Name &amp; <span style=\"color: #a31515;\">&#8220;&lt;\/a&gt; &lt;br \/&gt;&#8221;<\/span>)<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\">\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">Now we use Response.Write to write the results in the page, as a conventional href : &lt;a href=&#8217;URL&#8217;&gt;TEXT&lt;\/a&gt; and we put new line..<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">Finally we close the for each loop using Next, and when we run the application we will get:<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><a href=\"http:\/\/www.balata-albalad.org\/\">Balata-Albalad<\/a><br \/>\n<a href=\"http:\/\/www.google.jo\/\">Google Jordan<\/a><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\">\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\">Here is the same code in C#<\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\">\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\">\n<blockquote>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;\">protected<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> <span style=\"color: blue;\">void<\/span> Page_Load(<span style=\"color: blue;\">object<\/span> sender, <span style=\"color: #2b91af;\">EventArgs<\/span> e)<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><span> <\/span>{<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> <\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><span> <\/span><span style=\"color: #2b91af;\">XDocument<\/span> xmlDoc = <span style=\"color: #2b91af;\">XDocument<\/span>.Load(Server.MapPath(<span style=\"color: #a31515;\">&#8220;XMLFile.xml&#8221;<\/span>));<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> <\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><span> <\/span><span style=\"color: blue;\">var<\/span> xmlData = <span style=\"color: blue;\">from<\/span> webSite <span style=\"color: blue;\">in<\/span> xmlDoc.Descendants(<span style=\"color: #a31515;\">&#8220;Website&#8221;<\/span>) <\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><span> <\/span><span style=\"color: blue;\">where<\/span> (webSite.Attribute(<span style=\"color: #a31515;\">&#8220;lang&#8221;<\/span>).Value == <span style=\"color: #a31515;\">&#8220;ar&#8221;<\/span>) <\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><span> <\/span><span style=\"color: blue;\">select<\/span> <span style=\"color: blue;\">new<\/span> <\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><span> <\/span>{ <\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><span> <\/span>Name = webSite.Element(<span style=\"color: #a31515;\">&#8220;Name&#8221;<\/span>).Value, <\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><span> <\/span>Url = webSite.Element(<span style=\"color: #a31515;\">&#8220;Url&#8221;<\/span>).Value <\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><span> <\/span>} ;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> <\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><span> <\/span><span style=\"color: blue;\">foreach<\/span> (<span style=\"color: blue;\">var<\/span> item <span style=\"color: blue;\">in<\/span> xmlData)<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><span> <\/span>{<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><span> <\/span>Response.Write(<span style=\"color: #a31515;\">&#8220;&lt;a href='&#8221;<\/span><span> <\/span>+ item.Url + <span style=\"color: #a31515;\">&#8220;&#8216;&gt;&#8221;<\/span> + item.Name + <span style=\"color: #a31515;\">&#8220;&lt;\/a&gt; &lt;br \/&gt;&#8221;<\/span>);<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><span> <\/span>}<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> <\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><span> <\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"text-align: left; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; line-height: 115%; font-family: &quot;Courier New&quot;;\"><span> <\/span>}<\/span><\/p>\n<\/blockquote>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\">\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\">\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\">\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\">\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">That was a very simple example, for more information you can visit the following links or you can send me a comment about your question..<\/span><\/p>\n<ul>\n<li><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/bb308959.aspx\" target=\"_blank\">Linq on MSDN<\/a><\/span><\/li>\n<\/ul>\n<ul>\n<li><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><a href=\"http:\/\/wiki.asp.net\/page.aspx\/86\/linq-to-sql\/\" target=\"_blank\">wiki.asp.net<\/a><\/span><\/li>\n<\/ul>\n<ul>\n<li><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><a href=\"http:\/\/msdn.microsoft.com\/en-us\/vcsharp\/aa336746.aspx\" target=\"_blank\">101 Linq Examples from MSDN<\/a><\/span><\/li>\n<\/ul>\n<ul>\n<li><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/bb387098.aspx\" target=\"_blank\">Linq to XML in MSDN<\/a><br \/>\n<\/span><\/li>\n<\/ul>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\">\n<p class=\"MsoNormal\" style=\"margin-bottom: 0.0001pt; text-align: left; line-height: normal; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">Thanks for reading and applying. \ud83d\ude42<br \/>\n<\/span><\/p>\n<p class=\"MsoNormal\" style=\"text-align: left; direction: ltr; unicode-bidi: embed;\" dir=\"ltr\">\n","protected":false},"excerpt":{"rendered":"<p>Language Integrated Query (LINQ, pronounced &#8220;link&#8220;) is a Microsoft .NET Framework component that adds native data querying capabilities to .NET languages.(#) LINQ to XML is a built-in LINQ data provider that is implemented within the &#8220;System.Xml.Linq&#8221; namespace in .NET 3.5. As Microsoft says, LINQ to XML provides a clean programming model that enables you to<\/p>\n<div class=\"more-link\">\n\t\t\t\t <a href=\"http:\/\/www.idwaikat.me\/?p=68\" class=\"link-btn theme-btn\"><span>Read More <\/span> <i class=\"fa fa-caret-right\"><\/i><\/a>\n\t\t\t<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_expiration-date-status":"","_expiration-date":0,"_expiration-date-type":"","_expiration-date-categories":[],"_expiration-date-options":[]},"categories":[9],"tags":[11,15,16,12,10,13,14],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\r\n<title>LINQ To XML - Eng. Ibrahim Dwaikat<\/title>\r\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\r\n<link rel=\"canonical\" href=\"http:\/\/www.idwaikat.me\/?p=68\" \/>\r\n<meta property=\"og:locale\" content=\"en_US\" \/>\r\n<meta property=\"og:type\" content=\"article\" \/>\r\n<meta property=\"og:title\" content=\"LINQ To XML - Eng. Ibrahim Dwaikat\" \/>\r\n<meta property=\"og:description\" content=\"Language Integrated Query (LINQ, pronounced &#8220;link&#8220;) is a Microsoft .NET Framework component that adds native data querying capabilities to .NET languages.(#) LINQ to XML is a built-in LINQ data provider that is implemented within the &#8220;System.Xml.Linq&#8221; namespace in .NET 3.5. As Microsoft says, LINQ to XML provides a clean programming model that enables you to    Read More\" \/>\r\n<meta property=\"og:url\" content=\"http:\/\/www.idwaikat.me\/?p=68\" \/>\r\n<meta property=\"og:site_name\" content=\"Eng. Ibrahim Dwaikat\" \/>\r\n<meta property=\"article:published_time\" content=\"2009-03-01T22:11:04+00:00\" \/>\r\n<meta property=\"article:modified_time\" content=\"2009-07-13T22:34:42+00:00\" \/>\r\n<meta name=\"author\" content=\"admin\" \/>\r\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\r\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\r\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"http:\/\/www.idwaikat.me\/?p=68\",\"url\":\"http:\/\/www.idwaikat.me\/?p=68\",\"name\":\"LINQ To XML - Eng. Ibrahim Dwaikat\",\"isPartOf\":{\"@id\":\"http:\/\/www.idwaikat.me\/#website\"},\"datePublished\":\"2009-03-01T22:11:04+00:00\",\"dateModified\":\"2009-07-13T22:34:42+00:00\",\"author\":{\"@id\":\"http:\/\/www.idwaikat.me\/#\/schema\/person\/7738daf850bf9025cb97d4e728b96e05\"},\"breadcrumb\":{\"@id\":\"http:\/\/www.idwaikat.me\/?p=68#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/www.idwaikat.me\/?p=68\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/www.idwaikat.me\/?p=68#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/www.idwaikat.me\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"LINQ To XML\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/www.idwaikat.me\/#website\",\"url\":\"http:\/\/www.idwaikat.me\/\",\"name\":\"Eng. Ibrahim Dwaikat\",\"description\":\"Be better than expected\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/www.idwaikat.me\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"http:\/\/www.idwaikat.me\/#\/schema\/person\/7738daf850bf9025cb97d4e728b96e05\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/www.idwaikat.me\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/2.gravatar.com\/avatar\/8647144a952284a7cf0336a3632931a4?s=96&d=mm&r=g\",\"contentUrl\":\"http:\/\/2.gravatar.com\/avatar\/8647144a952284a7cf0336a3632931a4?s=96&d=mm&r=g\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/www.idwaikat.me\"],\"url\":\"http:\/\/www.idwaikat.me\/?author=1\"}]}<\/script>\r\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"LINQ To XML - Eng. Ibrahim Dwaikat","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/www.idwaikat.me\/?p=68","og_locale":"en_US","og_type":"article","og_title":"LINQ To XML - Eng. Ibrahim Dwaikat","og_description":"Language Integrated Query (LINQ, pronounced &#8220;link&#8220;) is a Microsoft .NET Framework component that adds native data querying capabilities to .NET languages.(#) LINQ to XML is a built-in LINQ data provider that is implemented within the &#8220;System.Xml.Linq&#8221; namespace in .NET 3.5. As Microsoft says, LINQ to XML provides a clean programming model that enables you to    Read More","og_url":"http:\/\/www.idwaikat.me\/?p=68","og_site_name":"Eng. Ibrahim Dwaikat","article_published_time":"2009-03-01T22:11:04+00:00","article_modified_time":"2009-07-13T22:34:42+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"http:\/\/www.idwaikat.me\/?p=68","url":"http:\/\/www.idwaikat.me\/?p=68","name":"LINQ To XML - Eng. Ibrahim Dwaikat","isPartOf":{"@id":"http:\/\/www.idwaikat.me\/#website"},"datePublished":"2009-03-01T22:11:04+00:00","dateModified":"2009-07-13T22:34:42+00:00","author":{"@id":"http:\/\/www.idwaikat.me\/#\/schema\/person\/7738daf850bf9025cb97d4e728b96e05"},"breadcrumb":{"@id":"http:\/\/www.idwaikat.me\/?p=68#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/www.idwaikat.me\/?p=68"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/www.idwaikat.me\/?p=68#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/www.idwaikat.me\/"},{"@type":"ListItem","position":2,"name":"LINQ To XML"}]},{"@type":"WebSite","@id":"http:\/\/www.idwaikat.me\/#website","url":"http:\/\/www.idwaikat.me\/","name":"Eng. Ibrahim Dwaikat","description":"Be better than expected","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/www.idwaikat.me\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"http:\/\/www.idwaikat.me\/#\/schema\/person\/7738daf850bf9025cb97d4e728b96e05","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/www.idwaikat.me\/#\/schema\/person\/image\/","url":"http:\/\/2.gravatar.com\/avatar\/8647144a952284a7cf0336a3632931a4?s=96&d=mm&r=g","contentUrl":"http:\/\/2.gravatar.com\/avatar\/8647144a952284a7cf0336a3632931a4?s=96&d=mm&r=g","caption":"admin"},"sameAs":["http:\/\/www.idwaikat.me"],"url":"http:\/\/www.idwaikat.me\/?author=1"}]}},"_links":{"self":[{"href":"http:\/\/www.idwaikat.me\/index.php?rest_route=\/wp\/v2\/posts\/68"}],"collection":[{"href":"http:\/\/www.idwaikat.me\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.idwaikat.me\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.idwaikat.me\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.idwaikat.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=68"}],"version-history":[{"count":15,"href":"http:\/\/www.idwaikat.me\/index.php?rest_route=\/wp\/v2\/posts\/68\/revisions"}],"predecessor-version":[{"id":81,"href":"http:\/\/www.idwaikat.me\/index.php?rest_route=\/wp\/v2\/posts\/68\/revisions\/81"}],"wp:attachment":[{"href":"http:\/\/www.idwaikat.me\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=68"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.idwaikat.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=68"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.idwaikat.me\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=68"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}