Get XML element content in InDesign faster?

Hi,
I need to get the content of a couple of XML elements in my document. I manage to do it trough a recursive function (see below).
On older slower Macs this it takes a while to process.
Is there anyone out there that have any suggestions on how to get it faster?

/bengt

tell application "Adobe InDesign CS2"
	tell active document
		set theRoot to (item 1 of XML elements) -- the root element
	end tell	
end tell
myLoopLoop(theRoot)

property myLoLoV : {}
property myHoHoV : {}
on myLoopLoop(myElement)
	
	tell application "Adobe InDesign CS2"
		tell active document
			if (name of markup tag of myElement is "Price") then
				set myCurrentID to id of myElement
				copy (contents of XML item id myCurrentID of myElement) & " -- " & (name of markup tag of myElement) to the end of myLoLoV
			end if
			
			if (name of markup tag of myElement is "DocumentName") then
				set myCurrentID to id of myElement
				copy (contents of XML item id myCurrentID of myElement) & " -- " & (name of markup tag of myElement) to the end of myHoHoV
			end if
			
			set moreElement to every XML element of myElement
			repeat with x from 1 to (count of moreElement)
				tell me to myLoopLoop(item x of moreElement)
			end repeat
		end tell
	end tell
end myLoopLoop

Hello,
I think that if you work directly within xml format without any useless information you’ll get much faster.
Why dont you export your xml in an xml file and then gather your data directly using a parser or a text editor and applescript ?
Igor