Re: Getting started with XML?
Re: Getting started with XML?
- Subject: Re: Getting started with XML?
- From: "Steven D. Majewski" <email@hidden>
- Date: Sat, 10 Feb 2007 14:38:38 -0500
On Feb 10,, at 12:38 PM, Michelle Steiner wrote:
Anyway, I was going about it all wrong. Someone had asked on a
list what music we listen to while running, so I exported my
running playlist. When I opened it, I saw that it was an XML file
(although I subsequently discovered that it's actually a plist
format), so I wanted to extract song titles and performers from the
list.
'Export Library ' exports the entire library as xml plist, but If you
have a playlist selected,
'Export' gives you the option of exporting as a text file. That might
have been the quickest route.
After all the help I got here, I then remembered that iTunes is
scriptable. It took me about five to fifteen minutes to write a
script that got the information directly from iTunes.
But your solution was also pretty good.
Since OSX has xsltproc built in, I think an xslt script is often a
lot easier that trying to
deal with xml in Applescript ( unless you already need to do
everything else in Applescript,
and really require getting XML data into your script. ) But doing it
in xslt runs into the
problems that the plist format is a particularly bad format for
anything else than what it was
designed for -- which is for some program to suck the whole thing up
into it's own native
data structures. The alternating keys and value the plist dictionary
elements make it
awkward to just grab a piece of info with an xpath expression. Just
as you discovered it
was awkward to deal with in Applescript. If you found it a difficult
task, I don't
think XMLlib is to blame -- the plist format is just a bad choice for
something it was never
really designed for.
-- Steve Majewski
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/mailman//archives/applescript-users
This email sent to email@hidden