Parse XML AppleScript
I would be grateful if anyone could help me.
I have this XML in a document below.
<?xml version="1.0" encoding="UTF-8"?>
<Question Parameters>
<Question>Which of these two colours do you like most?</Question>
<Response1>Red</Response1>
<Response2>Blue</Response2>
<Filename>Choose A Colour</Filename>
</Question Parameters>
I have the action below in Automator which runs a script. My functionality is to open the text file and move the xml text as a string in a variable. Then move the value of an xml element name "Response1" into a new variable.
on run {input, parameters}
tell application "TextEdit" to get text of document 1 as string
set myXMLSource to result as Unicode text
tell application "System Events"
set myResponseText to value of XML element named "Response1" of myXMLSource
end tell
end run
All I keep getting is an error asking me to "Check the actionʼs properties and try running the workflow again.", but my script looks exactly like the tutorials I have been reading.
Any suggestions?
Message was edited by: dwigg
Dual 2.3 GHz PowerPC G5