in reply to Checking XML well-formedness

You could wrap an eval around that XMLin() function. Looks like the error message gives explicit instructions on where to find the problem.