Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] XML pretty printer

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Harold <elharo AT metalab.unc.edu>
  • To: Luca Passani <passani AT eunet.no>
  • Cc: xom-interest <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] XML pretty printer
  • Date: Mon, 23 Jul 2007 05:58:09 -0400

Luca Passani wrote:

Is there a way to fix this with the XOM serializer/pretty printer? of course, I only want th extra line to apply to the "device" element and not to others.


When you pretty print, XOM assumes it can muck with the white space. You could probably override writeEndTag to add an extra line after certain elements. E.g.

protected void writeEndTag(Element element) {
super.writeEndTag(element);
if (element.getLocalName().equals("device")) {
breakLine();
}
}


--
Elliotte Rusty Harold elharo AT metalab.unc.edu
Java I/O 2nd Edition Just Published!
http://www.cafeaulait.org/books/javaio2/
http://www.amazon.com/exec/obidos/ISBN=0596527500/ref=nosim/cafeaulaitA/




Archive powered by MHonArc 2.6.24.

Top of Page