<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 5.00.3103.1000" name=GENERATOR></HEAD>
<BODY style="COLOR: #000000; FONT-FAMILY: Arial">
<DIV><FONT size=2><SPAN class=335042519-17092002>Hi,</SPAN></FONT></DIV>
<DIV><FONT size=2><SPAN class=335042519-17092002></SPAN></FONT> </DIV>
<DIV><FONT color=#ff0000 size=2><SPAN class=335042519-17092002>JDom beta version
8 seems to have an issue where it ignores the element content that has only
space(s) and writes it as an empty element.</SPAN></FONT></DIV>
<DIV><FONT size=2><SPAN class=335042519-17092002></SPAN></FONT> </DIV>
<DIV><FONT color=#ff0000 size=2><SPAN class=335042519-17092002>The problem
arises only when XMLOutputter(" ", true) constructor is
used.</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2><SPAN class=335042519-17092002>The following is a sample code:
</SPAN></FONT><FONT size=2><SPAN class=335042519-17092002></SPAN></FONT></DIV>
<DIV><FONT size=2><SPAN class=335042519-17092002></SPAN></FONT> </DIV>
<DIV><FONT size=2><SPAN class=335042519-17092002>import
org.jdom.Element;<BR>import org.jdom.Document;<BR>import
org.jdom.output.XMLOutputter;</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2><SPAN class=335042519-17092002>import
java.io.FileWriter;<BR>import java.io.IOException;</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2><SPAN class=335042519-17092002><BR>public class
JdomTest<BR>{<BR> public JdomTest()<BR>
{<BR> Element root = new
Element("Root");<BR> root.addContent(new
Element("child1").addContent("CCCC"));<BR>
root.addContent(new
Element("child2").addContent("DDDD"));<BR>
root.addContent(new Element("child3").addContent(" "));</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2><SPAN class=335042519-17092002>
Document doc = new Document(root);<BR>
try<BR>
{<BR> FileWriter writer = new
FileWriter("e:\\temp\\jdom\\jdom8\\java\\JdomText.xml");<BR>
XMLOutputter outputter = new XMLOutputter(" ",
true);<BR> outputter.output(doc,
writer);</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2><SPAN class=335042519-17092002>
}catch(IOException ioe)<BR>
{<BR>
System.out.println(ioe.getMessage());<BR>
}<BR> }</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2><SPAN class=335042519-17092002> public static void
main(String args[])<BR> {</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2><SPAN class=335042519-17092002>
JdomTest testing = new JdomTest();<BR>
System.exit(0);</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2><SPAN class=335042519-17092002>
}<BR>}</SPAN></FONT></DIV>
<DIV><FONT size=2><SPAN class=335042519-17092002></SPAN></FONT> </DIV>
<DIV><FONT size=2><SPAN class=335042519-17092002>
<DIV><FONT color=#ff0000 size=2><SPAN class=335042519-17092002>The output is
</SPAN></FONT></DIV>
<DIV><FONT size=2><SPAN class=335042519-17092002><?xml version="1.0"
encoding="UTF-8"?><BR><Root><BR> <child1>CCCC</child1><BR> <child2>DDDD</child2><BR> <child3
/><BR></Root></SPAN></FONT></DIV>
<DIV><FONT size=2><SPAN class=335042519-17092002></SPAN></FONT> </DIV>
<DIV><FONT color=#ff0000 size=2><SPAN
class=335042519-17092002></SPAN></FONT> </DIV>
<DIV><FONT color=#ff0000 size=2><SPAN class=335042519-17092002>instead
of</SPAN></FONT></DIV>
<DIV><FONT size=2><SPAN class=335042519-17092002><?xml version="1.0"
encoding="UTF-8"?><BR><Root><BR> <child1>CCCC</child1><BR> <child2>DDDD</child2><BR> <child3>
</child3><BR></Root></SPAN></FONT></DIV></SPAN></FONT></DIV>
<DIV><FONT size=2><SPAN class=335042519-17092002></SPAN></FONT> </DIV>
<DIV><FONT size=2><SPAN class=335042519-17092002>Thanks
</SPAN></FONT></DIV></BODY></HTML>