• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Getting started with XML?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: Getting started with XML?
      • From: Michelle Steiner <email@hidden>
References: 
 >Re: Getting started with XML? (From: Michelle Steiner <email@hidden>)
 >Re: Getting started with XML? (From: Luther Fuller <email@hidden>)
 >Re: Getting started with XML? (From: kai <email@hidden>)
 >Re: Getting started with XML? (From: Emmanuel <email@hidden>)
 >Re: Getting started with XML? (From: Michelle Steiner <email@hidden>)

  • Prev by Date: Re: Getting started with XML?
  • Next by Date: Re: Getting started with XML?
  • Previous by thread: Re: Getting started with XML?
  • Next by thread: Re: Getting started with XML?
  • Index(es):
    • Date
    • Thread