in reply to formatting text

a simple one liner is
perl -ne 'if (/^<item>/){s/[ \t]+/ /g;print;}' test.txt
I don't use \s because that would remove the newline character at the end of the line too.

Edit: made it a little shorter and added /g (which is of course the most important thing).