A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
XML and Related Technologies
Change Encoding of XML document.
Joined: Jul 05, 2001
Feb 26, 2005 06:27:00
How to change the encoding of XML document using Java program.
I am using following code snippet to create document object and it returns me the prolog as "<?xml version="1.0" encoding="ISO-8859-1"?>"
I am using org.apache.xerces.dom parser.
Document doc = new DocumentImpl(); Element rootNode = doc.createElement("parent"); doc.appendChild(rootNode);
How can i change the encoding of above document object.
Thanks for your time.
<b>L G Goundalkar</b><br /> <a href="mailto:firstname.lastname@example.org" rel="nofollow">email@example.com</a> <br />Sun Certified Programmer for Java 2 Platform.<br />Sun Certified Web Component Developer for J2EE.
Author and all-around good cowpoke
Joined: Mar 22, 2000
Feb 26, 2005 06:56:00
How are you doing output of this document to a file? It seems to me that internally the DOM will all be in Unicode and the file encoding is established in the output method. Look at the Transformer properties - there is an ENCODING property.
Java Resources at
Don't get me started about those stupid
subject: Change Encoding of XML document.
WebSphere 6.1 encoding exception
Generate XML / DOM using XSL and Xpath
need to update entry in XML file.
Not able to delete xml files after reading
default namespaces are being dropped when sent through a web service
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013