Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parsing XML with DOM
Message
 
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:
00962499
Views:
11
I don't see your problem, but...
loXML=CREATEOBJECT("Microsoft.XMLDOM")
loXML.async = .F.
loXML.SetProperty("SelectionLanguage","XPath")
*loXML.Load(m.lcPath+"terry.xml")
*loXML.LoadXML(m.lcXML)

* Return all nodes that have attribute "program"
loXX=m.loXML.documentElement.selectNodes('schedule/[@program]')
FOR lii=0 TO loXX.length-1
    ?loXX.Item(lii).Item(0).GetAttribute("time"))
NEXT

* Return all nodes that have attribute "program" with value P1877110087
loXX=m.loXML.documentElement.selectNodes('schedule/[@program="EP1877110087"]')
FOR lii=0 TO loXX.length-1
    ?loXX.Item(lii).Item(0).GetAttribute("time"))
NEXT
MartinJ

>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
"Navision is evil that needs to be erazed... to the ground"

Jabber: gorila@dione.zcu.cz
Jabber? Jabbim
Previous
Reply
Map
View

Click here to load this message in the networking platform