Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: parsing xml



On Jun 6, 2006, at 3:07 PM, Graham Jones wrote:

Users on this list tipped me off to some way cool ways of accessing XML
files. ... Say the xml file is "test.xml" on your desktop. It contains an xml tree
where "Book" is the first level, and "Chapter" is the 2nd.


--Getting the values (parsing):

set xmlFile to POSIX path of ((path to desktop as string) & "test.xml")
set myRecordList to (call method "dictionaryWithContentsOfFile:" of class
"NSDictionary" with parameter xmlFile ) as record ...

If that works, then what you've got isn't really an XML file. I mean, it is, but it's a very specific kind of XML, namely a property list stored as XML. (Property lists don't have to be XML, by the way.) The technique you're using won't work on any XML that isn't a property list -- a Keynote document, for example. You could use NSXMLDocument via "call method" instead, which would get you general XML parsing.



--Chris Nebel AppleScript Engineering

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-studio mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-studio/email@hidden

This email sent to email@hidden
References: 
 >Re: parsing xml (From: Graham Jones <email@hidden>)



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

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.