[jdom-interest] XMLOutputter clipping text ... a bug?

Jason Hunter jhunter at xquery.com
Fri Mar 5 13:42:25 PST 2004


I've never heard of this before.  I'm going to guess it has to do with 
your stream.  Dump it to System.out for another view.

-jh-

William Krick wrote:

> Using JDOM b9, when I run an xml file...
> 
> -----begin test.xml-----
> <?xml version="1.0" encoding="UTF-8"?><TEST>This is a test.</TEST>
> ------end test.xml------
> 
> ...through the following code...
> 
> 
>     String fileName = "test.xml";
>     File f = new File(fileName);
>     Document doc = null;
> 
>     //load the doc from the xml file
>     SAXBuilder builder = new SAXBuilder();
>     FileInputStream fis = null;
>     try {
>       fis = new FileInputStream(f);
>       doc = builder.build(fis);
>     }
>     catch (Exception ex) {
>     }
>     finally {
>       try { fis.close(); } catch (Exception ex) {}
>     }
> 
>     //
>     // you would do stuff to the doc here
>     //
> 
> 
>     // write the doc back out to the file
>     XMLOutputter fmt = new XMLOutputter();
>     FileOutputStream fos = null;
>     try {
>       fos = new FileOutputStream(f);
>       fmt.output(doc, fos);
>     }
>     catch (Exception ex) {
>     }
>     finally {
>       try { fos.close(); } catch (Exception ex) {}
>     }
> 
> 
> ... it comes out with the beginning of the text clipped like this...
> 
> -----begin test.xml-----
> ml version="1.0" encoding="UTF-8"?><TEST>This is a test.</TEST>
> ------end test.xml------
> 
> 
> 
> Is this a bug or am I doing something wrong?  This is REALLY frustrating.
> 
> ...
> Krick
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
> 



More information about the jdom-interest mailing list