A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Take Control of Upgrading to Yosemite
Take Control of Automating Your Mac
this week in the
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.
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.
I agree. Here's the link:
subject: Change Encoding of XML document.
default namespaces are being dropped when sent through a web service
Generate XML / DOM using XSL and Xpath
WebSphere 6.1 encoding exception
need to update entry in XML file.
Not able to delete xml files after reading
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014