To get the count of the number of records returned you could do this (substitute obj for XDocument if necessary):
var recordsReturned = XDocument.DOM.selectNodes( "//dfs:myFields/dfs:dataFields/d:VendorList" );
var numberOfRecords = recordsReturned.length;
For an easier way to get at the fields there are a couple shortcuts. Check out this tutorial for more effecient XPath:
http://www.w3schools.com/xpath/default.aspOr you could use variables for commonly used XPath, like this:
var XP_vendlist = "/dfs:myFields/dfs:dataFields/d:VendorList/";
var node1 = obj.DOM.selectSingleNode( XP_vendlist + "@name" );
Hope this helps, let us know if you have any more questions!
---------------
Matt Faus
InfoPath Dev Texas
Matt Faus / Microsoft InfoPath MVPQdabra® Software / Streamline data gathering to turn process into knowledge