XML/XPath: Difference between revisions
Content added Content deleted
Line 126: | Line 126: | ||
set xmlData to make new XML data with properties {name:"xmldata", text:theXMLdata} |
set xmlData to make new XML data with properties {name:"xmldata", text:theXMLdata} |
||
return my getBlock(xmlData's text, "item", 1) |
return my getBlock(xmlData's text, "item", 1) -- Solution to part 1 of problem. |
||
return my getElementValuesByName(xmlData's contents, "name") |
return my getElementValuesByName(xmlData's contents, "name") -- Solution to part 2 of problem. |
||
return my getElementValuesByName(xmlData's contents, "price") |
return my getElementValuesByName(xmlData's contents, "price") -- Solution to part 3 of problem. |
||
end tell</lang>Output for the three results (respectively):<lang AppleScript>"<item upc=\"123456789\" stock=\"12\"> |
end tell</lang>Output for the three results (respectively):<lang AppleScript>"<item upc=\"123456789\" stock=\"12\"> |