• 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: xml text to record
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: xml text to record
      • From: Luther Fuller <email@hidden>
References: 
 >xml text to record (From: Luther Fuller <email@hidden>)

  • Prev by Date: Re: xml text to record
  • Next by Date: Re: xml text to record
  • Previous by thread: Re: xml text to record
  • Next by thread: Re: xml text to record
  • Index(es):
    • Date
    • Thread