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 |