Hello,
I'd like to reiterate my old report about bug in serialization.
I have upgraded to 1.6 but it happens again and again.
Sometimes I cannot open XML document, it fails, that String
serialized with DOM4J is not valid, because it contains
invalid XML character.
Portion of XML:
<comment id="4"><created>2005-06-26 13:32</created>
<title>Re: GlobeTrotter GPRS - divné odpovědi</title>
<text format="0">
<pre>teepee pcmcia # cardctl status
Socket 0:
3.3V CardBus card
teepee pcmcia # cat /dev/tts/4
<</pre>
</text></comment>
it was generated with:
ByteArrayOutputStream os = new ByteArrayOutputStream();
OutputFormat format = new OutputFormat(null,false,"ISO-8859-2");
format.setSuppressDeclaration(true);
XMLWriter writer = new XMLWriter(os,format);
writer.write(data);
String result = os.toString();
Then I attempted to read it via:
Document data = DocumentHelper.parseText(stringData);
but it throws:
Caused by: org.dom4j.DocumentException:
Error on line 157 of document : Illegal XML character 
Nested exception: Illegal XML character 
at org.dom4j.io.SAXReader.read(SAXReader.java:482)
at org.dom4j.DocumentHelper.parseText(DocumentHelper.java:278)
at cz.abclinuxu.data.XMLHandler.lazyInit(XMLHandler.java:103)
The problematic character is "",
xmllint complaints this way:
parser error : xmlParseCharRef: invalid xmlChar value 30
I don't know, how the original input looked like. I cannot simulate
it manually, I just have to fix it several times per month.
I guess that these invalid entities may be some strange unicode
characters ..
Any idea, how to avoid this? Thanks
Leos
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
dom4j-dev mailing list
dom4j-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-dev