• 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 - System Events vs XMLlib
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: XML - System Events vs XMLlib


  • Subject: Re: XML - System Events vs XMLlib
  • From: Ed Stockly <email@hidden>
  • Date: Wed, 29 Aug 2007 08:09:45 -0700


Here's a sample of what I want..



--- the xml

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http:// 

www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">

<dict>

    <key>keyname</key>

    <integer>8</integer>

    <key>creation</key>

    <string>2007:06:12 20:13:52</string>

    <key>happy</key>

    </false>

</dict>

</plist>



How do I I search for "creation" and return the string value?


How to I search for "happy" and return "false"?


Thanks in advance..


Wayne, If that's all you want, and it's not unusual to want to pull just one or two values from an xml file, here's a quick way to do it.

set text item delimiters to "<key>creation</key>"
set creationDate to text item 2 of myText
set text item delimiters to "<string>"
set creationDate to text item 2 of creationDate
set text item delimiters to "</string>"
set creationDate to text item 1 of creationDate
set text item delimiters to "<key>happy</key>"
set happyValue to text item 2 of myText
set text item delimiters to "</"
set happyValue to text item 2 of happyValue
set text item delimiters to ">"
set happyValue to text item 1 of happyValue

return {creationDate, happyValue}

HTH

ES

=
 _______________________________________________
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 - System Events vs XMLlib
      • From: "Gary (Lists)" <email@hidden>
  • Prev by Date: Re: XML - System Events vs XMLlib
  • Next by Date: Re: XML - System Events vs XMLlib
  • Previous by thread: Re: XML - System Events vs XMLlib
  • Next by thread: Re: XML - System Events vs XMLlib
  • Index(es):
    • Date
    • Thread