Re: xml text to record
Re: xml text to record
- Subject: Re: xml text to record
- From: Luther Fuller <email@hidden>
- Date: Tue, 22 Nov 2011 11:35:13 -0600
I still haven't been able to make a record from xml formatted text, but I can do this ...
on run do shell script "drutil info -xml" set response to the result -- text in xml format
log response -- So you can see what you are doing
tell application "System Events" set xmlData to make new XML data with data response --> «class xmld» = XML data
XML element named "infodoc" of xmlData XML element named "infofordevice" of the result XML element named "deviceInfo" of the result XML element named "firmware" of the result value of XML attribute of the result end tell log the result end run
This may be the best I can do and is better than parsing the data out of the non-xml text which I consider somewhat unreliable. (At least, I've had some problems with doing that.)
Once you see the structure of the xml formatted text and understand where to use 'element' vs 'attribute', it's fairly easy to get the data you need. Still, I would like to get the first element of xmlData as a record.
|
_______________________________________________
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/archives/applescript-users
This email sent to email@hidden