Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parsing XML with DOM
Message
From
19/11/2004 18:11:01
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
17/11/2004 20:57:14
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Environment versions
Visual FoxPro:
VFP 7
Miscellaneous
Thread ID:
00962465
Message ID:
00963108
Views:
9
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform