• 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: Michelle Steiner <email@hidden>
  • Date: Thu, 7 Dec 2006 18:14:49 -0700

On Dec 7, 2006, at 3:10 PM, Christopher Nebel wrote:

-- assuming that "XMLfile" has been set to an alias...
tell application "System Events"
set foo to contents of XML file (path of f) -- "'f as text' would have worked, too, as would 'POSIX path of f'."
end tell


The explicit "path of" is necessary because System Events does not recognize an alias a selector data for a file.

Once you're done there, "foo" will be an "XML data" object specifier. To get parts of it, direct your eyes upward in the dictionary from "XML file" to "XML data" and observe that an "XML data" contains "XML elements". You can also get the text representation by saying "text of", but for an element that's mostly only useful for debugging.

Thanks.

Don't forget that if the XML file you're dealing with is a plist, then you ought to be using the Property List Suite instead. It's easier to work with, and there's no guarantee that a plist is XML.

No, it's not a plist; it's an XML export from iTunes.

-- Michelle

--
It is not who I am underneath, but what I do, that defines me.

_______________________________________________
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: Steve Bennett <email@hidden>
References: 
 >Getting started with XML? (From: Michelle Steiner <email@hidden>)
 >Re: Getting started with XML? (From: Christopher Nebel <email@hidden>)

  • Prev by Date: Re: GUI scripting and PreFab 1.4.1 question
  • Next by Date: Re: Running an applescript from a Filemaker Advanced file (Addressing Problems)
  • Previous by thread: Re: Getting started with XML?
  • Next by thread: Re: Getting started with XML?
  • Index(es):
    • Date
    • Thread