Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parse XML in VFP possibly using xpath
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Title:
Parse XML in VFP possibly using xpath
Miscellaneous
Thread ID:
00691656
Message ID:
00691656
Views:
74
I have some XML similar to the sample below. I would like to parse it and place it into two VFP cursors, CurCustomer and CurInvoices. Currently I am parsing the XML with code something like:
WITH loXMLDOM.DocumentElement.ChildNodes
FOR iCount = 0 TO .LENGTH - 1
*APPEND BLANK
FOR iChild = 0 TO .ITEM(iCount).ChildNodes.LENGTH - 1
lcVar = .ITEM(iCount).ChildNodes(iChild)

I am looking for a VFP code sample showing a "better" [best practice] method, possibly using XPATH, to accomplish my objective.

<MYDataSet>
<arcust>
<ccustno>4045 </ccustno>
<ccompany>MY MOTOR SPORTS, INC. </ccompany>
<arinvc>
<ccustno>4045 </ccustno>
<cinvno> 37466</cinvno>
</arinvc>
<arinvc>
<ccustno>4045 </ccustno>
<cinvno> 37946</cinvno>
</arinvc>
<arinvc>
<ccustno>4045 </ccustno>
<cinvno> 39226</cinvno>
</arinvc>
<arinvc>
<ccustno>4045 </ccustno>
<cinvno> 39482</cinvno>
</arinvc>
<arinvc>
<ccustno>4045 </ccustno>
<cinvno> 40302</cinvno>
</arinvc>
<arinvc>
<ccustno>4045 </ccustno>
<cinvno> 40727</cinvno>
</arinvc>
</arcust>
<arcust>
<ccustno>4049 </ccustno>
<ccompany>ZZZ AUTO SERVICE </ccompany>
<arinvc>
<ccustno>4049 </ccustno>
<cinvno> 37276</cinvno>
</arinvc>
<arinvc>
<ccustno>4049 </ccustno>
<cinvno> 38184</cinvno>
</arinvc>
<arinvc>
<ccustno>4049 </ccustno>
<cinvno> 38929</cinvno>
</arinvc>
<arinvc>
<ccustno>4049 </ccustno>
<cinvno> 40117</cinvno>
</arinvc>
<arinvc>
<ccustno>4049 </ccustno>
<cinvno> 41486</cinvno>
</arinvc>
<arinvc>
<ccustno>4049 </ccustno>
<cinvno> 42820</cinvno>
</arinvc>
</arcust>
</MYDataSet>

TYIA,
Robert - Zxytek
Next
Reply
Map
View

Click here to load this message in the networking platform