<?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>VB.NET Code Snippets and Tutorials &#187; XML Programming</title>
	<atom:link href="http://www.vbneter.com/category/xml-programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.vbneter.com</link>
	<description>Free VB.NET Code Snippets, Source Code, Articles, Examples, Tutorials and Programming Help</description>
	<lastBuildDate>Thu, 17 Sep 2009 01:37:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to Count XML Nodes from VB.NET</title>
		<link>http://www.vbneter.com/2009/08/how-to-count-xml-nodes-from-vb-net/</link>
		<comments>http://www.vbneter.com/2009/08/how-to-count-xml-nodes-from-vb-net/#comments</comments>
		<pubDate>Fri, 14 Aug 2009 13:17:05 +0000</pubDate>
		<dc:creator>Kulrom</dc:creator>
				<category><![CDATA[XML Programming]]></category>

		<guid isPermaLink="false">http://www.vbneter.com/?p=28</guid>
		<description><![CDATA[This is how do you quickly count the child nodes of an XML file. Say that you have an XML data as follows:


< ?xml version="1.0" encoding="UTF-8"?>

  
    
      < title>Sql Server 2008 Query Performance ...< /title>
      978-1-4302-1902-6
    
 [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_33" class="wp-caption alignnone" style="width: 230px"><img src="http://www.vbneter.com/wp-content/uploads/2009/08/xml-data-count-child-nodes.jpg" alt="Count XML Child Nodes" title="xml-data-count-child-nodes" width="220" height="119" class="size-full wp-image-33" /><p class="wp-caption-text">Count XML Child Nodes</p></div>
<p>This is how do you quickly <strong>count the child nodes of an XML file</strong>. Say that you have an XML data as follows:<br />
<span id="more-28"></span></p>
<pre class="brush:xml">
< ?xml version="1.0" encoding="UTF-8"?>
<inventory>
  <books>
    <book>
      < title>Sql Server 2008 Query Performance ...< /title>
      <isbn>978-1-4302-1902-6</isbn>
    </book>
    <book>
      < title>Pro ASP.NET MVC Framework< /title>
      <isbn>978-1-4302-1007-8</isbn>
    </book>
  </books>
</inventory></pre>
<p>To count the book items you may use counter iterating the books/book tags but this is how do you <strong>get the total number</strong> of book <strong>nodes in only one line</strong>.</p>
<pre class="brush:vb.net">Dim document As New XmlDocument
document.Load(xmlfilepath)
Dim count As Integer = document.SelectNodes("inventory/books/book").Count</pre>
<p><strong>Enjoy!</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.vbneter.com/2009/08/how-to-count-xml-nodes-from-vb-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
