Here is what the XML Recommendation says are valid characters for XML:Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]Invalid characters are anything else. And it should be obvious that to avoid that exception you should not attempt to parse files that contain any invalid characters.