Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Parsing XML with DOM
Message
De
19/11/2004 18:11:01
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
17/11/2004 20:57:14
Information générale
Forum:
Visual FoxPro
Catégorie:
XML, XSD
Versions des environnements
Visual FoxPro:
VFP 7
Divers
Thread ID:
00962465
Message ID:
00963108
Vues:
8
>I followed the thread 904549 and found it very helpful but I was wondering if the DOM object (ox = createobject("MSXml.DOMDocument")) can extract the data when it is formatted as attributes of the element as in:
>
><schedule program='EP1877110087' station='19211' time='2004-11-19T23:00:00Z' duration='PT00H30M' stereo='true' closeCaptioned='true'/>
><schedule program='EP1877110088' station='19211' time='2004-11-19T23:30:00Z' duration='PT00H30M' stereo='true' closeCaptioned='true'/>
><schedule program='EP0174130101' station='19211' time='2004-11-20T00:00:00Z' duration='PT00H30M' stereo='true' closeCaptioned='true'/>
><schedule program='EP0174130102' station='19211' time='2004-11-20T00:30:00Z' duration='PT00H30M' stereo='true' closeCaptioned='true'/>
><schedule program='MV0782170000' station='19211' time='2004-11-20T01:00:00Z' duration='PT02H00M'/>
>
>Can anyone help me out here?
>
>Thanks
>- Don

Don,
This type of simple XML doesn't need DOM processing IMHO. Simply use XmlToCursor (adding a root tag and preferably a schema). ie:
TEXT TO m.myXML noshow
<data>
<schedule program='EP1877110087' station='19211' time='2004-11-19T23:00:00Z' duration='PT00H30M' stereo='true' closeCaptioned='true'/>
<schedule program='EP1877110088' station='19211' time='2004-11-19T23:30:00Z' duration='PT00H30M' stereo='true' closeCaptioned='true'/>
<schedule program='EP0174130101' station='19211' time='2004-11-20T00:00:00Z' duration='PT00H30M' stereo='true' closeCaptioned='true'/>
<schedule program='EP0174130102' station='19211' time='2004-11-20T00:30:00Z' duration='PT00H30M' stereo='true' closeCaptioned='true'/>
<schedule program='MV0782170000' station='19211' time='2004-11-20T01:00:00Z' duration='PT02H00M'/>
</data>
ENDTEXT

XMLTOCURSOR(m.myXML,'myCursor') && With a schema this would do nicely. 
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform