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!

want to remove encoding="UTF-8" from xml header

843834Nov 2 2006 — edited Nov 8 2006
hey,
we always get xmls starting with 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
or
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
the ONLY DIFFERENCE between the two headers is encoding="UTF-8" cause the xml i have has no encoding="UTF-8" in its header, and it does work fine for all perposes.
I use to manipulate the file SAXBuilder
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse(ips);

The result of the document in both cases was having the header

encoding="UTF-8"

I want to get rid of encoding="UTF-8" cause it makes xmls useless for other uses. I tried several tests: just read the document THAT HAS NO encoding="UTF-8" and printed the document once again, so i got the encoding="UTF-8" in the xml file.

How can i tell the transformer or the xmloutputter to NOT write the encoding="UTF-8" in the xml

thanks in advance
bye
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 6 2006
Added on Nov 2 2006
2 comments
1,091 views