[jdom-interest] jdom 1.0 XMLOutputter
Bill Leng
wleng at metatomix.com
Tue Sep 21 07:04:25 PDT 2004
Hi,
I am trying jdom 1.0 and found that XMLOutputter now manipulates \n and
\r. This behaviour, I believe, is a bug because I can not get exactly
what I put in. The actual manipulation code is in
XMLOutputter.escapeElementEntities. It is added in jdom 1.0. Can anyone
shed some light on this? Please see the attached test file for detail.
--
Bill Leng
Sr. Software Engineer
Metatomix, Inc.
Tel: (901)261-8911
Fax: (901)261-8901
-------------- next part --------------
import org.jdom.*;
import org.jdom.output.*;
import java.io.*;
public class JdomTest
{
public static void main(String[] args)
{
String s1 = "\n";
Text t1 = new Text(s1);
String s2 = "\r";
Text t2 = new Text(s2);
XMLOutputter o = new XMLOutputter();
StringWriter w1 = new StringWriter();
StringWriter w2 = new StringWriter();
try
{
o.output(t1, w1);
String ss1 = w1.toString();
if(s1.equals(ss1))
{
System.out.println("Output 1: OK");
}
else
{
System.out.println("Output 1: wrong");
}
o.output(t2, w2);
String ss2 = w2.toString();
if(s2.equals(ss2))
{
System.out.println("Output 2: OK");
}
else
{
System.out.println("Output 2: wrong");
}
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
More information about the jdom-interest
mailing list