View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Adrian C[_2_] Adrian C[_2_] is offline
external usenet poster
 
Posts: 21
Default Reading through an XML file

On 21/01/2010 23:14, dec3 wrote:
Hi


<snip

' This sections adds detail to the spreadsheet where there is an
existing sale offer and provide details
mydata =
oDom.DocumentElement.SelectSingleNode("record/offer/for").Text
' SOMEWHERE / SOMEHOW HERE I NEED TO LOOP THROUGH THE XML
RECORDS BUT I CAN ONLY READ THE FIRST!
END IF


You need the selectNodes method. That returns a NodesList which ye can
wander down using the .nextNode method once found how many in the list.

Set oNList = oNode.selectNodes("record/offer/for")

nTot = oNList.length - 1

For nCnt = 0 to nTot

Set oThisNode = oXMLTreeList.nextNode()

' do whatever here for each node

Next

--
Adrian C