XML and illegal characters
843834Jan 29 2004 — edited Feb 2 2004The big picture:
1. I have legacy data in an Oracle database.
2. I have written some web services to access the data, that work 99%.
3. In some of the data there are characters that cause my web services to break. These characters are the type that get copy/pasted from a Micro$oft Word document.
How do I get this type of data out of my Oracle CLOB as a java.lang.String that can be serialized/deserialized by my web services.
The error that I get is similar to:
deserialization error: deserialization error: XML parsing error: com.sun.xml.rpc.sp.ParseException:16: Illegal XML character: & # x 1 c;
I can't be the first to run into this.
I tried to handle this with the character encoding:
byte[] clob = mediator.retrieveClob().getBytes("Unicode"); //gets clob from Oracle database
result.setDescription(new String(clob,"Unicode")); //sets value for object to be sent via web service