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!

Reading UTF-7 XML document in Java

843834Jul 15 2009 — edited Jul 15 2009
I have an XML document and I want to add PrcessingInstruction to it.

<?xml version="1.0" encoding="UTF-7" ?>
<root_element>
<sections>
<section_introduction>
<order-no>108800674</order-no>
<order-type>219</order-type>
<created-date>5. november 2008</created-date>
....
.....

when trying to parse it like

File tmpFile = new File("C:\\ProvisioningEventError58412.xml");
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

factory.setValidating(false);
Document doc = factory.newDocumentBuilder().parse(tmpFile);
System.out.println("end");


I get an exception on Document doc = factory.newDocumentBuilder().parse(tmpFile);

org.xml.sax.SAXParseException: Invalid encoding name "UTF-7".
[Fatal Error] ProvisioningEventError58412.xml:1:40: Invalid encoding name "UTF-7".

Is it possible to set encoding on DocumentBuilder, so it can work with UTF-7 or is there any other was to parse it for adding ProcessingInstruction. Actually I want to add a CSS/XSL file for formatting the XML File.

Edited by: aamaam on Jul 15, 2009 5:18 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 12 2009
Added on Jul 15 2009
1 comment
401 views