[XOM-interest] XML pretty printer

Elliotte Harold elharo at metalab.unc.edu
Mon Jul 23 05:58:09 EDT 2007


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/


More information about the XOM-interest mailing list