Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] question about Serializer

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: Ittay Dror <ittayd AT qlusters.com>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] question about Serializer
  • Date: Tue, 18 Apr 2006 07:10:23 -0400

Ittay Dror wrote:
i want to write an xhtml document with Serializer. This class writes nodes with no children in
the <.../> form, rather than <...></...> form.

this causes the document to be rendered differently. specifically, it writes a span tag as
<span.../>, where i need it to be <span...></span> (don't ask me why, it's
just like this)

can i control Serializer, so it outputs nodes in the "verbose" form? maybe
per node name?


There's no switch for this. However it should be easy enough to write a subclass of Serializer that does this. All you need to do is override writeEmptyElementTag in the manner described in the JavaDocs:

protected void writeEmptyElementTag(Element element)
throws IOException {
writeStartTag(element);
writeEndTag(element);
}

You shouldn't need to change anything else.

--
Elliotte Rusty Harold elharo AT metalab.unc.edu
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim




Archive powered by MHonArc 2.6.24.

Top of Page