[jdom-interest] outputting a doc question

Alex Colic alex.colic at pop-ware.com
Thu Aug 16 07:17:02 PDT 2001


Hi, I am having a bit of a problem using XMLOutputter.

A snippet of the document I have read is:

<web-app>
    <context-param>
        <param-name>TechSupport</param-name>
        <param-value>techsupport-rd at pop-ware.com</param-value>
    </context-param>

    <context-param>
        <param-name>Port</param-name>
        <param-value>10002</param-value>
    </context-param>

If I change one of the param-values and then use the method below my
document gets saved like this:

<web-app>
    <context-param>
        <param-name>TechSupport</param-name>
        <param-value>techsupport-rd at pop-ware.com</param-value>

    </context-param>
    <context-param>
        <param-name>Port</param-name>
        <param-value>99</param-value>

    </context-param>

Why is XMLOutputter creating a new line before the </context-param> tag? All
I want the outputter to do is save this file in the format that it is in
presently.

Any help is appreciated.

Alex

private void saveDocument(Document doc)
{
  XMLOutputter out=new XMLOutputter("    ",true);
  out.setTextNormalize(true);
  try
    {
      out.output(doc,new BufferedOutputStream(new FileOutputStream(new
File(path))));
      out.output(doc,System.out);
    }
  catch(FileNotFoundException fe){cat.error(fe);}
  catch(IOException e){cat.error(e);}
}





More information about the jdom-interest mailing list