Re: How to work with XML data using System Events?
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