Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: parsing an XML file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: parsing an XML file



FIrst thing : ther is a space in "Slides " :p

set the_root to XMLRoot the_doc
set {my_track} to XMLXPath the_root with "/Project/Movie/Track/Track_Name[text()='\"Slides\"']"

The correct XPath _expression_ is this one : "/Project/Movie/Track/Track_Name[text()='\"Slides\"']", text() allow you to get the textual content of a node.
You might also consider removing all the quotes of your XML file, I think that this will produce more errors than anything else.

++ Jean-Baptiste

With AppleScript and XMLLib, I can't seem to programmatically traverse the XML tree.
This code:

set the_file to choose file
set the_doc to XMLOpen the_file
set the_root to XMLRoot the_doc

set {my_track} to XMLXPath the_root with "Movie/Track[Track_Name=\"Slides\"]"
XMLDisplayXML my_track

gives a "Can't get item 1 of {}" error, yet I can get to the right track with:
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >parsing an XML file (From: email@hidden)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.