Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: XML - System Events vs XMLlib




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:
http://lists.apple.com/mailman/options/applescript-users/email@hidden
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.