in reply to Dealing with Malformed XML

You could eval all your calls to the XML parser and then, if there are errors, examine the source more closely with regexen and the like. That way, you save parsing things twice for only the docs with problems and you don't have to bend XML laws to get what you need.
"A man's maturity -- consists in having found again the seriousness one had as a child, at play." --Nietzsche