Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need some XML parsing help
Message
From
28/03/2005 08:03:14
 
 
To
27/03/2005 19:43:46
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
00999113
Message ID:
00999396
Views:
21
This is the code which will save my bacon. I do appreciate you expanding on Rick's sugestion for XPATH. You guys are the "Bomb"

Glenn
>Glenn,
>
>I have had some struggles with this recently as well. Rick's suggestion of XPATH is correct, but it can really be painful at first. Try this as a sample:
>
>
>loXml = NEWOBJECT("MSXML2.DomDocument")
>loXml.async = .F.
>IF loXml.load("x.xml")
>    * pulling the price from the 'c' section in your example
>    lcPrice = loXml.documentElement.selectSingleNode("//datafield[@tag='260']/subfield[@code='c']").text
>ENDIF
>
>
>There are extra things you need to check for to make it robust, i.e. that selectSingleNode returned an object, that the object has elements. Where most people get stuck is not realising they can nest the query information.
>
>HTH
Previous
Reply
Map
View

Click here to load this message in the networking platform