|
-
April 20th, 2007, 09:32 AM
#1
XML SelectNodes (Position)
Is there any way to select a node by its position in an xml document? The example would be something like this:
<Element Name="Element1">
<Value Name="Value1"/>
<Value Name="Value2"/>
<Value Name="Value3"/>
</Element>
<Element Name="Element2">
<Value Name="Value4"/>
<Value Name="Value5"/>
<Value Name="Value6"/>
</Element>
<Element Name="Element3">
<Value Name="Value7"/>
<Value Name="Value8"/>
<Value Name="Value9"/>
</Element>
And I need to select the third child of every Element. So the returned set of nodes would be Value3,Value6, and Value9. I tried something like this:
dim xml as string 'set to xml example above
dim xmlDoc as freethreadeddomdoc30
set xmldoc = new freethreadeddomdoc30
xmldoc.loadxml xml
xmldoc.selectnodes(".//Element/Value[position()=3]")
I've tried every possible syntax that I can think of to accomplish this, and can't get it right. Anyone know how to go about doing this?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|