[jdom-interest] Debugging Output

guru at stinky.com guru at stinky.com
Sun Jun 17 06:45:54 PDT 2001


> From: "Alex Rosen" <arosen at silverstream.com>@jdom.org on 06/14/2001 11:14 AM AST
> 
> I've mentioned before that I think we need a really easy (single-line) way to
> dump a Document or Element to System.out, in a readable format for debugging.
> This could just be a static method like XMLOutputter.dump().

On Thu, Jun 14, 2001 at 12:09:07PM -0500, Eliyahu Hershfeld wrote:
> Here is a one line way. Its not as short as you would like and maybe not as easy, but...
> try {new XMLOutputter("  ", true).output(doc, System.out);}catch(Exception e){}

That works fine.  Also

System.out.println(new XMLOutputter().outputString(doc));

(or fill in your favorite constructor parameters, or substitute "element" for "doc")

Reading the JavaDoc is educational -- and fun too!

 - A


-- 
Alex Chaffee                       mailto:alex at jguru.com
jGuru - Java News and FAQs         http://www.jguru.com/alex/
Creator of Gamelan                 http://www.gamelan.com/
Founder of Purple Technology       http://www.purpletech.com/
Curator of Stinky Art Collective   http://www.stinky.com/



More information about the jdom-interest mailing list