Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] Custom Serializer?

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Egon Willighagen <egon.willighagen AT gmail.com>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: [XOM-interest] Custom Serializer?
  • Date: Wed, 5 Aug 2009 21:31:05 +0200

Hi all,

I am please to see the ongoing efforts for new XOM releases and have
been using XOM with much pleasure.

Recently, I had to need to both 'format' the output (like with
Serializer), but not output the XML declaration, so I made this class:

public class CustomSerializer extends Serializer {

public CustomSerializer(OutputStream out) {
super(out);
}

public CustomSerializer(OutputStream out, String encoding)
throws UnsupportedEncodingException {
super(out, encoding);
}

protected void writeXMLDeclaration() throws IOException {
// do nothing
}

}


Now, I had to put this class in the nu.xom package because the
writeXMLDeclaration() method was protected.

Is there a better way in 1.2.x to get indentation but no XML declaration?

Looking forward to hearing from you,

Egon

--
Post-doc @ Uppsala University
http://chem-bla-ics.blogspot.com/




Archive powered by MHonArc 2.6.24.

Top of Page