Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Invalid XML Characters

843834Mar 22 2004 — edited Jun 16 2008
Anyone know how to get around what are typically considered invalid XML characters? I'm wrapping some of our existing claims transactions in XML, but the existing transactions contain control characters such as unicode 0x1e, 0x1c, 0x1d.

File outputFile = new File( outputFilename );
DOMParser parser = new DOMParser();

// Get the DOM tree as a Document object
parser.parse( xmlDocument );
Document doc = parser.getDocument();

This results in:

[Fatal Error] ClaimTest.xml:9:74: An invalid XML character (Unicode: 0x1e) was found in the element content of the document.
org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x1e) was found in the element content of the document.
( ... )

Can this be handled with JDOM using CDATA?

Thanks in Advance


Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 14 2008
Added on Mar 22 2004
5 comments
1,917 views