set theXMLdata to "
Invisibility Cream 14.50 Makes you invisible Levitation Salve 23.99 Levitate yourself for up to 3 hours per application
Blork and Freen Instameal 4.95 A tasty meal in a tablet; just add water Grob winglets 3.56 Tender winglets of Grob. Just add water
" on getElementValuesByName(theXML, theNameToFind) set R to {} tell application "System Events" repeat with i in theXML set {theName, theElements} to {i's name, i's XML elements} if (count of theElements) > 0 then set R to R & my getElementValuesByName(theElements, theNameToFind) if theName = theNameToFind then set R to R & i's value end repeat end tell return R end getElementValuesByName on getBlock(theXML, theItem, theInstance) set text item delimiters to "" repeat with i from 1 to theInstance set {R, blockStart, blockEnd} to {{}, "<" & theItem & space, ""} set x to offset of blockStart in theXML if x = 0 then exit repeat set y to offset of blockEnd in (characters x thru -1 of theXML as string) if y = 0 then exit repeat set R to characters x thru (x + y + (length of blockEnd) - 2) of theXML as string set theXML to characters (y + (length of blockEnd)) thru -1 of theXML as string end repeat return R end getBlock tell application "System Events" set xmlData to make new XML data with properties {name:"xmldata", text:theXMLdata} return my getBlock(xmlData's text, "item", 1) -- Solution to part 1 of problem. return my getElementValuesByName(xmlData's contents, "name") -- Solution to part 2 of problem. return my getElementValuesByName(xmlData's contents, "price") -- Solution to part 3 of problem. end tell