SourceForge.net wrote:
Bugs item #1156909, was opened at 2005-03-04 11:50Is this fixed in CVS? If so I'm quite tempted to run a CVS-version if bugIDs: 1156909, 1088314, 1070309/1035511 are fixed in current source as these are production-critical for my application.
BTW:
Are the bugs listed at http://sourceforge.net/tracker/?group_id=16035&atid=116035 closed when they are:
a) released in a new-version build (which I guess would include b) and c) under :-) )
b) fixed and commited to CVS
c) b) + tested
?
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=116035&aid=1156909&group_id=16035
Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: Buggy Document.getXMLEncoding / Document.asXML
Initial Comment: Try this:
import org.dom4j.Document; import org.dom4j.DocumentHelper;
public class TestDom4J { public static void main(String[] args) throws Exception { String xml = "<?xml version='1.0' encoding='iso-8859-1'?><Message>Hi there</Message>"; Document doc = DocumentHelper.parseText (xml); System.out.println ("The encoding is " + doc.getXMLEncoding ()); System.out.println ("As XML: " + doc.asXML ()); } }
The result is:
The encoding is null As XML: <?xml version="1.0" encoding="UTF-8"?> <Message>Hi there</Message>
Solution:
Step 1: add setXMLEncoding to Interface org.dom4j.Document
Step 2: change DocumentHelper.parseText (String) to
public static Document parseText(String text) throws
DocumentException {
SAXReader reader = new SAXReader();
String encoding = getEncoding(text);
InputSource source = new InputSource(new
StringReader(text));
source.setEncoding(encoding);
Document doc = reader.read(source);
doc.setXMLEncoding (encoding);
return doc; }
----------------------------------------------------------------------
You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=116035&aid=1156909&group_id=16035
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
dom4j-dev mailing list
dom4j-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-dev
------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ dom4j-dev mailing list dom4j-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dom4j-dev