http://www.perlmonks.org?node_id=954117


in reply to How to Truncate Corrupt Document.xml Files?

I would start by using a streaming (SAX) parser and maintaining a stack of unclosed tags. Have you tried that yet?