<DIV>&nbsp;</DIV>
<DIV>Use root.addContent("\n");</DIV>
<DIV>&nbsp;</DIV>
<DIV>instead of making newline a Text object.</DIV>
<DIV>Reason: </DIV>
<DIV>&nbsp;</DIV>
<DIV>root.addContent(content1);<BR>root.addContent(newline);<BR>root.addContent(content2);</DIV>
<DIV>root.addContent(newline); // NOTE </DIV>
<DIV>&nbsp;</DIV>
<DIV>the last action would give ILLEGAL ADD error on runtime because</DIV>
<DIV><STRONG>newline is already a child of root </STRONG></DIV>
<DIV><STRONG>OR</STRONG></DIV>
<DIV><STRONG>root already has a child named newline.</STRONG></DIV>
<P><STRONG></STRONG>&nbsp;</P>
<P><STRONG>Regards</STRONG></P>
<P><STRONG>Himank......</STRONG></P>
<P>&nbsp;</P>
<DIV><BR></DIV>
<DIV>&nbsp;</DIV>
<DIV><BR>Element root = new Element("ROOT");<BR>Text newline = new Text("");<BR>Text content1 = new Text("");<BR>Text content2 = new Text("");<BR><BR>content1.setText("test1");<BR>newline.setText("\n"); //This seems kind of hackish<BR>content2.setText("test2");<BR><BR>root.addContent(content1);<BR>root.addContent(newline);<BR>root.addContent(content2);</DIV>
<DIV><BR><B><I>jdom-interest-request@jdom.org</I></B> wrote:</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">Send jdom-interest mailing list submissions to<BR>jdom-interest@jdom.org<BR><BR>To subscribe or unsubscribe via the World Wide Web, visit<BR>http://www.jdom.org/mailman/listinfo/jdom-interest<BR>or, via email, send a message with subject or body 'help' to<BR>jdom-interest-request@jdom.org<BR><BR>You can reach the person managing the list at<BR>jdom-interest-owner@jdom.org<BR><BR>When replying, please edit your Subject line so it is more specific<BR>than "Re: Contents of jdom-interest digest..."<BR><BR><BR>Today's Topics:<BR><BR>1. Re: &amp; problems (Paul Libbrecht)<BR>2. The correct way to insert newlines and other text codes into<BR>JDOM elements (Kevin Chiu)<BR><BR><BR>----------------------------------------------------------------------<BR><BR>Message: 1<BR>Date: Mon, 12 Sep 2005 10:13:26 +0200<BR>From: Paul Libbrecht <PAUL@ACTIVEMATH.ORG><BR>Subject: Re: [jdom-interest] &amp;
 problems <BR>To: Tatu Saloranta <COWTOWNCODER@YAHOO.COM><BR>Cc: jdom interest <JDOM-INTEREST@JDOM.ORG><BR>Message-ID: &lt;6270c84e7ae6a0f24a3b5d22db7740d1@activemath.org&gt;<BR>Content-Type: text/plain; charset=ISO-8859-1; format=flowed<BR><BR><BR>Le 9 sept. 05, à 19:47, Tatu Saloranta a écrit :<BR>&gt; Does anyone know of xml processing package that does<BR>&gt; allow validation of the output? I have been thinking<BR>&gt; of writing such functionality into Woodstox, as it<BR>&gt; would seem potentially useful, but absence (?) of<BR>&gt; others doing that makes me wonder if it would be truly<BR>&gt; needed.<BR><BR>DTD-awareness would definitely help some output.<BR>Our DTD is a mix of several DTDs and contains several implicit <BR>attributes such as namespace declarations... I have proposed a patch to <BR>XMLOutputter which uses a DTD-parser loaded DTD in order to avoid the <BR>addition of these implicit attributes... our re-output sources are <BR>suddenly readable again!<BR><BR>But
 I would more call this usage of DTD a "notation" usage instead of a <BR>validation...<BR><BR>I wouldn't know how to validate the output of XMLOutputter except <BR>reparse it!!<BR><BR>paul<BR><BR><BR><BR><BR>------------------------------<BR><BR>Message: 2<BR>Date: Mon, 12 Sep 2005 03:37:41 -0500<BR>From: Kevin Chiu <KEVIN.GC+JDOM@GMAIL.COM><BR>Subject: [jdom-interest] The correct way to insert newlines and other<BR>text codes into JDOM elements<BR>To: jdom-interest@jdom.org<BR>Message-ID: &lt;1f32181a0509120137c240cf2@mail.gmail.com&gt;<BR>Content-Type: text/plain; charset=ISO-8859-1<BR><BR>Hello,<BR><BR>What's the correct way to add newlines (or other special characters)<BR>to the text of a JDom element?<BR>This is how I'm doing it now:<BR><BR>Element root = new Element("ROOT");<BR>Text newline = new Text("");<BR>Text content1 = new Text("");<BR>Text content2 = new Text("");<BR><BR>content1.setText("test1");<BR>newline.setText("\n"); //This seems kind of
 hackish<BR>content2.setText("test2");<BR><BR>root.addContent(content1);<BR>root.addContent(newline);<BR>root.addContent(content2);<BR><BR><BR><BR>------------------------------<BR><BR>_______________________________________________<BR>To control your jdom-interest membership:<BR>http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com<BR><BR>End of jdom-interest Digest, Vol 14, Issue 10<BR>*********************************************<BR></BLOCKQUOTE><p>__________________________________________________<br>Do You Yahoo!?<br>Tired of spam?  Yahoo! Mail has the best spam protection around <br>http://mail.yahoo.com