[jdom-interest] insert a new line after the root

TAZ0789 at aol.com TAZ0789 at aol.com
Wed Sep 11 20:44:51 PDT 2002


Hi,

   I'm writing a program that can help generate all the source and deployment 
descriptor for the EJB 2.0 CMP Beans.  I'm writing the part where I need to 
generate the xml files.  When I add children to the root, it's funny to see 
how the first child is aligned with the parent while all the other children 
has their own line.  Is there a way to insert a new line after the parent, so 
that the first child will have its own line?  Here's my source and resulting 
xml:

Source:

Element root = new Element("GREETING");
root.setText("Hello JDOM!");

Element child = new Element("KID");
child.setText("child 1");

Element child1 = new Element("KID1");
child1.setText("child 2");

root.addContent(child);
root.addContent(child1);

Document doc = new Document(root);


Resulting XML: 

<GREETING>Hello JDOM!<KID>child 1</KID>
       <KID1>child 2</KID2>
</GREETING>

Please help.  Thanks.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20020911/64142ce1/attachment.htm


More information about the jdom-interest mailing list