This sounds like a job for some sort of custom extension of java.io.FilterInputStream that would sit between your source and your XML parser while deleting illegal characters.
What is the source of this XML? Do you have any idea why it mixes these illegal characters in?
Joined: Sep 26, 2007
I am sure not how these characters coming into my configuration XML. One common pattern I noticed that if I edit XML in Weblogic Workshop this problem comes. So what is the solution? Read this XML in java class, remove all the characters and again write it in file?
Are you reading the XML files using a different character encoding setting than what the actual character encoding of the files is?
Make sure that if a file is for example encoded using UTF-8, you're reading it as an UTF-8 file. If you'd use a wrong character encoding to read the file, you could get strange errors like you describe.