"Derek Hart" <de********@yahoo.comwrote in message
news:#W*************@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