Thanks Bill and Paul.
Bill, the mentioned characters may be illegal for XML, but my problem was with characters such as 0xe, 0xf, etc.
What I found out is that there is a set of 32 control characters in ASCII which are not meant to be printed on screen, but only perform some special keyboard functions. You can find them here:
They're obsolete now and somehow coming into my XML. There are two solutions to it:
1. Remove them by pattern matching as mentioned in this thread. (best soln)
2. If you wanna keep them (just like me) then change your XML version to 1.1 and escape the characters as:
Here ch is the illegal character. After this you can unescape them using StringUtils unescapeNumericChar() method.
Hope this is useful to someone.