Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Change Encoding of XML document.

 
L Goundalkar
Ranch Hand
Posts: 395
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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.



How can i change the encoding of above document object.


Thanks for your time.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13062
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic