[jdom-interest] jdom document

Alex Chaffee guru at edamame.stinky.com
Fri Sep 29 06:37:29 PDT 2000


> > I have a question about org.jdom.document
> > When does it support the getSerializedForm() method?
> > Has anyone developed this method?

Sorry, I meant

String toMyFavoriteSerializedForm(Element element) {
 StringWriter sw = new StringWriter();
 XMLOutputter xo = new XMLOutputter();
 xo.printElement(element, sw);
 return sw.toString();
}

Note that the problem with having a single "getSerializedForm" method
is that there is no one canonical serialized form for any elemnt.  The
XMLOutputter has options for changing lots of things (whitespace,
indenting, etc. etc.).

I'd like to add some more methods to XMLOutputter, specifically

 public String outputString(Element) 

et al. -- but I thought I'd start with the basics.

 - 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