Hi,
I've done very little XML with VB6 and when I have, the file format was somewhat different to the file I now need to process.
The file looks like this:
<os>
<o c="A1D001">
<i c="BOARD001" q="1" />
<i c="BOOKS002" q="2" />
</o>
<o c="ABS001">
<i c="CALC001" q="3" />
<i c="CAS001" q="4" />
</o>
</os>
Where o is an order and c is the customer code.
The the items are i and c is the item code and q is the quantity.
I need to pull out the customer code for each order and the following item codes and quantites.
I know the following code will loop through the orders. But I don't know how to actually pull out the customer codes or how to nest a loop within this to pull out the items:
Dim oDom As New DOMDocument
Dim oOrders As IXMLDOMNodeList
Dim oOrder As IXMLDOMNode
With oDom
If .Load(sXML) Then
If Not oDom.documentElement Is Nothing Then
Set oOrders = oDom.selectNodes("//os/*")
For Each oOrder In oOrders
'get customer code
'loop through items getting code/qty
Next oOrder
End If
End If
End With
Any help greatly appreciated!
Cheers
Marc
I've done very little XML with VB6 and when I have, the file format was somewhat different to the file I now need to process.
The file looks like this:
<os>
<o c="A1D001">
<i c="BOARD001" q="1" />
<i c="BOOKS002" q="2" />
</o>
<o c="ABS001">
<i c="CALC001" q="3" />
<i c="CAS001" q="4" />
</o>
</os>
Where o is an order and c is the customer code.
The the items are i and c is the item code and q is the quantity.
I need to pull out the customer code for each order and the following item codes and quantites.
I know the following code will loop through the orders. But I don't know how to actually pull out the customer codes or how to nest a loop within this to pull out the items:
Dim oDom As New DOMDocument
Dim oOrders As IXMLDOMNodeList
Dim oOrder As IXMLDOMNode
With oDom
If .Load(sXML) Then
If Not oDom.documentElement Is Nothing Then
Set oOrders = oDom.selectNodes("//os/*")
For Each oOrder In oOrders
'get customer code
'loop through items getting code/qty
Next oOrder
End If
End If
End With
Any help greatly appreciated!
Cheers
Marc