I searched here and Google and came up with nothing, so I am hoping that someone here can help me understand how to parse "href=" from the XML Header in the following example.
<?xml version="1.0" encoding="UTF-8"?>
<foo version="2" href="/event/189" product="Server">
<name>The Name</name>
</foo>
Here is what I do know. To parse the element "name" in the xml file, I can do the following:
set source_xml to choose file "Select your xml source"
set posix_source_xml to POSIX path of source_xml
tell application "System Events"
set xml_file to XML file posix_source_xml
tell xml_file
tell XML element "foo"
set name_value to value of XML element "name"
end tell
end tell
end tell
But how do I get the value for "href=" in the "foo" header? I tried this with no success:
set source_xml to choose file "Select your xml source"
set posix_source_xml to POSIX path of source_xml
tell application "System Events"
set xml_file to XML file posix_source_xml
tell xml_file
set foo_value to value of XML element "foo"
end tell
end tell
Even if that did work, I would imagine it would return - version="2" href="/event/189" product="Server" - and not just - /event/189.
Any assistance on this would be greatly appreciated!