Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Thu, 26 Jun 2008 17:42:07 -0700,    group: microsoft.public.dotnet.xml        back       


Count Nodes   
I wish to get a count of nodes in an xml file in vb.net, so I am using the 
following, as a simple example:



MyCount = xmlNodePart.Current.Select.//MyNode/Record[*]).Count



I saw in some xml specs that instead of [*] it should be [@*], but that does 
not work. Why would the @ symbol be needed?



Derek
date: Thu, 26 Jun 2008 17:42:07 -0700   author:   Derek Hart

Re: Count Nodes   
"Derek Hart"  wrote in message 
news:#WL0h6#1IHA.528@TK2MSFTNGP02.phx.gbl...
> I wish to get a count of nodes in an xml file in vb.net, so I am using the 
> following, as a simple example:
>
>
>
> MyCount = xmlNodePart.Current.Select.//MyNode/Record[*]).Count
>
>
>
> I saw in some xml specs that instead of [*] it should be [@*], but that 
> does not work. Why would the @ symbol be needed?
>
>
>
> Derek
>
>
* represents a wildcard for current node type, normally this means all 
elements, @ is a shortcut for attributes so @* is all attributes.
If you want all nodes in a file you do //node() or count(//node())
The expression you gave, if it were legal, tries to do something different 
altogether. It is fetching the count of those Record elements that have a 
parent of MyNode and that have child elements.

-- 

Joe Fawcett (MVP - XML)
http://joe.fawcett.name
date: Fri, 27 Jun 2008 08:35:36 +0100   author:   Joe Fawcett am

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us