Script to convert XML data into tab-separated text?

Use XSLT. The syntax is pretty ugly, but it’ll get the job done. Get a copy of XSLT Tools osax, then Google for “XML to tab-delimited” and “XSLT” - it’s a common enough request so you should be able to dig up some useful info.

If you really want to do it manually, use a proper XML parser like System Events’ XML Suite, Late Night Software’s XML Tools osax or Satimage’s XMLLib osax. (Don’t try to parse XML yourself using TIDs or regular expressions as it’s totally unsafe and can easily go wrong in all sorts of subtle and not-so-subtle ways unless you really, really know what you’re doing.)