I Have run into a very strange bug/feature with a combination of Xalan and
DOM4j

I have a multi-line string (mystr) with windows standard #13#10 characters
as line terminators
Example:

Line1
Line2
Line3
Line4

I add it as an element using dom4j:

root.addElement("body").addText(mystr)

I use Xalan to style the xml to html in java code:

ByteArrayOutputStream temp = new ByteArrayOutputStreamEx(1024);
Transformer t = template.newTransformer();
DocumentSource ds = new DocumentSource(doc);
InputSource is = ds.getInputSource();
XMLReader xr = ds.getXMLReader();
t.transform(new SAXSource(xr,is),new StreamResult(temp));

Then the html output is (Using <xsl:value-of select="body"> in the xsl
template)

line1&#13;
line2&#13;
line3&#13;
Line4

As you can see extra &#13; entities are added to the output

However if I modify the line

t.transform(new SAXSource(xr,is),new StreamResult(temp));

to

t.transform(new SAXSource(is),new StreamResult(temp));

(Skip using the XMLReader provided by dom4j)

then the output is correct. How can I still use the XMLReader
and still get the correct result?
 -------------------------------------------------------------------------- 
 �byrg� ��n var�andi t�lvup�st:                                             
 Your E-mail responsibilities:                                              
 http://www.hugvit.is/tolvupostur                                           
 -------------------------------------------------------------------------- 





_______________________________________________________________

Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to