[jdom-interest] XMLOutputter(Format.getCompactFormat)

Rolf Lear jdom at tuis.net
Wed Apr 11 03:35:11 PDT 2012


Hi Lighton.

Hmmm.... it's a bug. So many things going through my head right now.... 
like how can that be?

But, I am stepping through the code, and yes, it's a bug.

I am (was) certain I had test cases that cover this condition.... but 
obviously I don't.

I am working on it with 'top priority'.

Rolf

On 11/04/2012 5:40 AM, Lighton Phiri wrote:
> import java.io.File;
> import java.io.FileWriter;
> import java.io.IOException;
>
> // jdom2 imports
> import org.jdom2.Document;
> import org.jdom2.JDOMException;
> import org.jdom2.input.SAXBuilder;
> import org.jdom2.output.Format;
> import org.jdom2.output.XMLOutputter;
>
> public class FirstRecipeJDOM {
>
>      public static void main(String[] args) {
>          File XMLFile = new File("file.xml");
>          FileWriter JDOMRawOutputFile = null;
>          SAXBuilder builder = new SAXBuilder();
>
>          try {
>              Document XMLDocument = builder.build(XMLFile);
>              XMLOutputter XMLOutput = new
> XMLOutputter(Format.getCompactFormat());
>              XMLOutput.output(XMLDocument, System.out);
>
>              JDOMRawOutputFile = new FileWriter(new File("jdom_recipes.xml"));
>              XMLOutput.output(XMLDocument, JDOMRawOutputFile);
>          }
>          catch(IOException ioe) {
>              System.out.println(ioe.getMessage());
>          }
>          catch(JDOMException jdome) {
>              System.out.println(jdome.getMessage());
>          }
>      }
> }



More information about the jdom-interest mailing list