• 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: How to work with XML data using System Events?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to work with XML data using System Events?


  • Subject: Re: How to work with XML data using System Events?
  • From: pete boardman <email@hidden>
  • Date: Mon, 7 Nov 2005 11:18:37 +0000

On 3 Nov 2005, at 20:08, Emmanuel wrote:
Such as XMLLib.osax, for instance.

Emmanuel, thanks for the great XML tutorial on your Satimage site. I learnt a lot of useful stuff. I hadn't realised how complicated XML could be... :-)


I also didn't know that XPath provided a kind of query language for XML files until I saw it working with your examples. It's not easy (like regular expressions) but it could provide a good alternative to cracking open XML the hard way. For example, to find the machine name from the system profile XML file (like Matt's example earlier did), it appears that you can do stuff like this:

--
set the_doc to XMLOpen alias "Macintosh HD:Users:pete:Desktop:system_profile.xml"
set the_root to XMLRoot the_doc -- uses XMLLIB osax
set i to (XMLGetText (XMLXPath the_root with "//key[text() ='machine_name' ]/following-sibling::string[1]"))
--


(contents of first <string> element following a <key> element called 'machine_name').

I don't think you can use XPaths with the Apple-supplied XML scripting commands, though.

thanks!

Pete

_______________________________________________
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


  • Follow-Ups:
    • Re: How to work with XML data using System Events?
      • From: Emmanuel <email@hidden>
References: 
 >How to work with XML data using System Events? (From: pete boardman <email@hidden>)
 >Re: How to work with XML data using System Events? (From: "Steven D. Majewski" <email@hidden>)
 >Re: How to work with XML data using System Events? (From: Emmanuel <email@hidden>)

  • Prev by Date: Re: New FireFox 1.5 browser -- applescript implementation
  • Next by Date: Re: Who has that property?
  • Previous by thread: Re: How to work with XML data using System Events?
  • Next by thread: Re: How to work with XML data using System Events?
  • Index(es):
    • Date
    • Thread