<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>TechnoBlogy &#187; XML</title>
	<atom:link href="http://technoblogy.net/category/technology/xml/feed" rel="self" type="application/rss+xml" />
	<link>http://technoblogy.net</link>
	<description>Technology with a Big difference</description>
	<lastBuildDate>Thu, 09 Sep 2010 08:02:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Return the value for the specific attribute using XPathNodeIterator</title>
		<link>http://technoblogy.net/return-the-value-for-the-specific-attribute-using-xpathnodeiterator/</link>
		<comments>http://technoblogy.net/return-the-value-for-the-specific-attribute-using-xpathnodeiterator/#comments</comments>
		<pubDate>Sun, 01 Nov 2009 15:14:17 +0000</pubDate>
		<dc:creator>Nauman</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ADO.NET]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[xpath]]></category>

		<guid isPermaLink="false">http://technoblogy.net/return-the-value-for-the-specific-attribute-using-xpathnodeiterator/</guid>
		<description><![CDATA[I will use the following XML document in the example below. &#60;? xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34; ?&#62; &#60; users &#62; &#60; user FirstName =&#34;Tom&#34; LastName =&#34;Adams&#34; Age =&#34;23&#34; /&#62; &#60; user FirstName =&#34;Jhon&#34; LastName =&#34;Brams&#34; Age =&#34;17&#34; /&#62; &#60; user FirstName =&#34;Bill&#34; LastName =&#34;Smith&#34; Age =&#34;33&#34; /&#62; &#60;/ users &#62; The code prints out all the [...]]]></description>
			<content:encoded><![CDATA[<p>I will use the following XML document in the example below.</p>
<blockquote><p>&lt;? xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;      <br />&lt; users &gt;      <br />&lt; user FirstName =&quot;Tom&quot; LastName =&quot;Adams&quot; Age =&quot;23&quot; /&gt;      <br />&lt; user FirstName =&quot;Jhon&quot; LastName =&quot;Brams&quot; Age =&quot;17&quot; /&gt;      <br />&lt; user FirstName =&quot;Bill&quot; LastName =&quot;Smith&quot; Age =&quot;33&quot; /&gt;       <br />&lt;/ users &gt;</p>
</blockquote>
<p>The code prints out all the user nodes of the users node that have an age with a value greater than 17</p>
<blockquote><p>// Read the xml from resource file</p>
<p>string xml = Resources.Users;      <br />using (StringReader sr = new StringReader(xml))       <br />{      <br />XPathDocument document = new XPathDocument(sr);       <br />XPathNavigator navigator = document.CreateNavigator();       <br />XmlNamespaceManager ns = new XmlNamespaceManager(navigator.NameTable);</p>
<p>//Selects all the user nodes of the users node that     <br />// have an age with a value greater than 17</p>
<p>XPathNodeIterator it = navigator.Select(&quot;/users/user[@Age&gt;17]&quot;);     <br />while (it.MoveNext())      <br />{       <br />// access the atributes      <br />string firstName = it.Current.GetAttribute(&quot;FirstName&quot;, ns.DefaultNamespace);      <br />string lastName = it.Current.GetAttribute(&quot;LastName&quot;, ns.DefaultNamespace);      <br />// Print out      <br />Console.WriteLine( &quot;{0} {1}&quot;, firstName, lastName );       <br />}       <br />}</p>
</blockquote>
<script type="text/javascript" class="owbutton" src="http://onlywire.com/btn/button_1305" title="Return the value for the specific attribute using XPathNodeIterator" url="http://technoblogy.net/return-the-value-for-the-specific-attribute-using-xpathnodeiterator/"></script>]]></content:encoded>
			<wfw:commentRss>http://technoblogy.net/return-the-value-for-the-specific-attribute-using-xpathnodeiterator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
