[jdom-interest] XMLOutputter extraspacing in reused Documents

Jon Baer jonbaer at digitalanywhere.com
Thu May 10 03:02:11 PDT 2001


Normally Ive used JDOM for outputting an XML stream without having to reuse the XML
document, but in something I just did I get extra returns in the previously built
Document between the Elements:

<?xml version="1.0"?>
<aiml version="1.0">

  <category>

    <pattern>THIS IS TARGET * 1</pattern>

    <template>Sorry.  I don't know.</template>

  </category>

 <category>
  <pattern>THIS IS TARGET * 2</pattern>
  <template>Sorry.  I don't know.</template>
 </category>
</aiml>

Using the latest build I beleive, any ideas?

- Jon

Code:

File file = new File(TARGETS_AIML);
   SAXBuilder builder = new SAXBuilder();
   Document doc = builder.build(file);
   XMLOutputter out = new XMLOutputter(" ", true);
   out.setOmitEncoding(true);
   out.setLineSeparator("\n");
   Element root = doc.getRootElement();





More information about the jdom-interest mailing list