Dim navigator As XPathNavigator = CreateNavigator()
Dim nodes As XPathNodeIterator =
navigator.Select("/my:myFields/my:group2", NamespaceManager)
Dim nodesNavigator As XPathNavigator = nodes.Current
Dim nodestext As XPathNodeIterator =
nodesNavigator.SelectDescendants(XPathNodeType.Text, False)
While nodestext.MoveNext()
MessageBox.Show(nodestext.Current.Value)
End While
--
kevin
BTW, since you are a regular question poster in this group and seem to write
code for your InfoPath form templates, you may want to take a few minutes to
help out a member of the InfoPath team and answer a few or all of his
questions. Check out his post here:
http://msdn.microsoft.com/newsgroups/default.aspx?query=7+questions+about+code+usage+in+your+InfoPath+forms&dg=microsoft.public.infopath&cat=en-us-msdn-officedev-infopath&lang=en&cr=US&pt=6E98618B-8F9E-4724-8A45-96C336E31A25&catlist=B7714BAA-0D60-40B0-A226-8B9CF33299A5%2C774F24A2-F71F-425F-AC2B-DC48AB0DA5C9&dglist=&ptlist=&exp=&sloc=en-us
Thanks!
---
S.Y.M. Wong-A-Ton
I picked up this particular code from
http://msdn2.microsoft.com/en-us/library/system.xml.xpath.xpathnodeiterator.aspx
Thanks for your suggestion, I will try it this morning.
--
kb
A good resource for learning to work with the XPathNavigator and
XPathNodeNodeIterator classes in InfoPath 2007 is:
http://msdn2.microsoft.com/en-us/library/bb509311.aspx
It contains VB.NET code snippets, so it might help. Let us know how you get
along.
Changing .text to .element still iterates the entire form, it shows the
repeating table values at the end. Therefore the XpathNodeIterator ignores
the XPath address specified in the navigator.Select
Very frustrating, especially when this would be a very common task, anyway I
will try some other things.
Thanks
This piece of code helped the last person who was experiencing difficulties
with SelectDescendants. I've tried to translate it to VB for you and
implement it in the code you already had (I did not test it!):
Dim navigator As XPathNavigator = CreateNavigator()
Dim nodes As XPathNodeIterator = navigator.Select("/my:myFields/my:group2",
NamespaceManager)
While nodes.MoveNext()
MessageBox.Show(nodes.Current.SelectSingleNode("my:firstfieldinrow",
NamespaceManager).Value)
MessageBox.Show(nodes.Current.SelectSingleNode("my:secondfieldinrow",
NamespaceManager).Value)
End While
I'm assuming that "/my:myFields/my:group2" is your repeating group.
my:firstfieldinrow is the name of a field in a row of the repeating table.
I am trying to loop through all the rows within a repeating table
and retrieve the values in each row. I will give your suggestion ago.
Thanks again for your help!
kb