InfoPath – Update Repeating Elements/Nodes in a Secondary Data Source
Programmatically loop through each node in an xml data source to find a specific element/node by the attribute value. This may be required to populate a CAML template before submitting to SharePoint via a web service. Post comments discuss a scenario where the function provided in the article can be used.
See also InfoPath Code – Loop through items in a secondary data source from a SharePoint List for the details of a solution which implements the function provided in the article, as well as a modified version.