[jdom-interest] XMLOutputter.outputElementContent bug?

philip.nelson at omniresources.com philip.nelson at omniresources.com
Mon Apr 23 05:38:14 PDT 2001


this method was just updated last week.  Do you have the latest?

> -----Original Message-----
> From: Mark Ayad [mailto:mayad at ogilvy.net]
> Sent: Monday, April 23, 2001 4:06 AM
> To: jdom-interest at jdom.org
> Subject: [jdom-interest] XMLOutputter.outputElementContent bug?
> 
> 
> 
> Hello all,
> 
> I have tried to use outputElementContent on a jdom element
> to print the elements contents using a writer to the system
> out, but nothing happens.
> 
> outputter.outputElementContent(header,new 
> OutputStreamWriter(System.out));
> 
> Any suggestions out there ?
> 
> Regards
> 
> Mark
> 
> *************** example java test *********************
> 
> 
> // import java classes
> import java.io.*;
> 
> // import jdom classes
> import org.jdom.*;
> import org.jdom.output.XMLOutputter;
> import org.jdom.input.SAXBuilder;
> 
> /**
>  * simple test.xml file
>  *
>  * <site>
>  * <header><head><title>jdom is excellent</title></head></header>
>  * <footer/>
>  * </site>
>  */
> public class JdomUnitTest
> {
>   /** */
>   public static void main(String args[])
>   {
>     SAXBuilder builder = new
> SAXBuilder("org.apache.xerces.parsers.SAXParser");
> 
>     try
>     {
>       Document doc = builder.build(new File("test.xml"));
> 
>       Element root = doc.getRootElement();
> 
>       Element header = root.getChild("header");
> 
>       XMLOutputter outputter = new XMLOutputter();
> 
>       // this works
>       //outputter.output(header,System.out);
> 
>       // this does not
>       outputter.outputElementContent(header,new
> OutputStreamWriter(System.out));
> 
>     }
>     catch(JDOMException e)
>     {
>       // error thrown
>     }
>     catch(IOException i)
>     {
>       // error thrown
>     }
> 
>   }
> }
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/yo
uraddr at yourhost.com



More information about the jdom-interest mailing list