Hi :)
I need help selecting particular nodes with the SelectChildren method
I get a simple xml from the web (excerpt):
<ab:store>
<ab:goods>
<ab:icecream>
<ab:flavor_01 >
100
</ab:flavor_01>
<ab:flavor_02 >
200
</ab:flavor_02>
<ab:flavor_03 >
300
</ab:flavor_03>
</ab:icecream>
<ab:chocolate >
<ab:flavor_01 >
100
</ab:flavor_01>
<ab:flavor_02 >
200
</ab:flavor_02>
<ab:flavor_03 >
300
</ab:flavor_03>
</ab:chocolate>
</ab:goods>
</ab:store>
Using this code:
Dim strNamespaceURI As String = "http://www.site.com/schema/"
Dim objDocument As XPathDocument = New
XPathDocument(" http://www.site.com/document")
Dim objNavigator As XPathNavigator = objDocument.Cre ateNavigator()
Dim objNamespaceMan ager As XmlNamespaceMan ager = New
XmlNamespaceMan ager(objNavigat or.NameTable)
objNamespaceMan ager.AddNamespa ce("ab", strNamespaceURI )
Dim objIterator As XPathNodeIterat or =
objNavigator.Se lect("/ab:store/ab:goods", objNamespaceMan ager)
--- till now everything works fine, objIterator is fine, I can do with it
whatever I want
While objIterator.Mov eNext()
--- then I try to get objIterator's children
Dim objIterator_Sub As XPathNodeIterat or =
objIterator.Cur rent.SelectChil dren("ab:icecre am", strNamespaceURI )
--- now objIterator_Sub doesn't return any nodes :( - tho it has 3 children
can any1 help me please - how do I get node's children with <exactly>
SelectChildren( name as string, namespaceuri as string) ...
calling it like SelectChildren( XPathNodeType.A ll) works fine - but it's no
use to me.
TIA
I need help selecting particular nodes with the SelectChildren method
I get a simple xml from the web (excerpt):
<ab:store>
<ab:goods>
<ab:icecream>
<ab:flavor_01 >
100
</ab:flavor_01>
<ab:flavor_02 >
200
</ab:flavor_02>
<ab:flavor_03 >
300
</ab:flavor_03>
</ab:icecream>
<ab:chocolate >
<ab:flavor_01 >
100
</ab:flavor_01>
<ab:flavor_02 >
200
</ab:flavor_02>
<ab:flavor_03 >
300
</ab:flavor_03>
</ab:chocolate>
</ab:goods>
</ab:store>
Using this code:
Dim strNamespaceURI As String = "http://www.site.com/schema/"
Dim objDocument As XPathDocument = New
XPathDocument(" http://www.site.com/document")
Dim objNavigator As XPathNavigator = objDocument.Cre ateNavigator()
Dim objNamespaceMan ager As XmlNamespaceMan ager = New
XmlNamespaceMan ager(objNavigat or.NameTable)
objNamespaceMan ager.AddNamespa ce("ab", strNamespaceURI )
Dim objIterator As XPathNodeIterat or =
objNavigator.Se lect("/ab:store/ab:goods", objNamespaceMan ager)
--- till now everything works fine, objIterator is fine, I can do with it
whatever I want
While objIterator.Mov eNext()
--- then I try to get objIterator's children
Dim objIterator_Sub As XPathNodeIterat or =
objIterator.Cur rent.SelectChil dren("ab:icecre am", strNamespaceURI )
--- now objIterator_Sub doesn't return any nodes :( - tho it has 3 children
can any1 help me please - how do I get node's children with <exactly>
SelectChildren( name as string, namespaceuri as string) ...
calling it like SelectChildren( XPathNodeType.A ll) works fine - but it's no
use to me.
TIA
Comment