Mailing Lists: Apple Mailing Lists

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

(no subject)



Hi,

I am trying to create an XML version of a file using XML suite, and have run into an issue where the following works:
------------------------------------------------
set xmlFile to (choose file) as Unicode text

tell application "System Events"
   set titleValue to value of XML element "title" of XML element "channel" of XML element "rss" of contents of XML file xmlFile
   display dialog "the title is " & titleValue
end tell
------------------------------------------------

but the code I want where a POSIX path is used to identify the file to process, rather than having the user select it through a dialog, shown below, does not work, even when the same file is processed in both cases:
------------------------------------------------
set xmlFile to read file ("/valid/path/to/file/RSS.xml" as POSIX file)

tell application "System Events"
   set titleValue to value of XML element "title" of XML element "channel" of XML element "rss" of contents of XML file xmlFile
   display dialog "the title is " & titleValue
end tell
------------------------------------------------

Running the second code snippet generates an NSReceiverEvaluatonScriptError. 
Questions:
- Can anyone shed any light on what the difference between output of the two selection processes is?
- What do I need to do to get the second code snippet working as expected!

cheers

Will
 _______________________________________________
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

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.