Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need some XML parsing help
Message
 
 
À
25/03/2005 07:46:28
Information générale
Forum:
Visual FoxPro
Catégorie:
XML, XSD
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
00999113
Message ID:
00999351
Vues:
17
This message has been marked as the solution to the initial question of the thread.
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
- Craig

"If you're not prepared to be wrong, you will never come up with anything original."
- Sir Ken Robinson
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform