Hello,
Can anybody suggest the best approach for encoding invalid XML characters
into an XML document? For example, the Unicode character with the
hexadecimal code 000C can be encoded into a Java character literal as
follows:
char c = '\u000C';
I tried encoding this character into an XML string using a standard
character reference. For example:
String s = "<tag></tag>";
However, when attempting to parse this into a DOM Document using Xerces, the
following exception is raised:
org.xml.sax.SAXParseException: Character reference "" is an
invalid XML character.
...
at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
In case anybody is curious about why I want to perform such an encoding,
I'll briefly explain. Some databases allow these characters in text fields.
I have a web service that performs a database query and encodes the results
into XML for delivery in a SOAP response. If the database query produces a
result set containing illegal XML characters, they still need to be encoded
into the SOAP response in some way.
Thanks in advance for any suggestions.
Cheers,
Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]