You create your document in memory ???

If this is the case, you can use text to
correctly format your text and use different
output formats to change the way the output
is written.

<code>*
Element data = new DefaultElement( "Data");
Element font = new DefaultElement( "Font");
font.add( new DefaultText( "hi there"));

data.add( new DefaultText( "    "));
data.add( font);
data.add( new DefaultText( "    "));

// Normal output.
OutputFormat format = new OutputFormat();
XMLWriter writer = new XMLWriter( System.out, format);
writer.write( data);

// This should give you:
// <Data>    <Font>hi there</Font>    </Data>

// 'Pretty' output
format.setNewLines( true);
format.setIndent( "  ");
writer.write( data);

// This should give you:
// <Data>
//   <Font>hi there</Font>
// </Data>

</code>

The writer should not add or remove information
unless you tell it to.

Regards,
Edwin

*note: code not tested



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to