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: "Michael Kay" <mike AT saxonica.com>
  • To: "'Elliotte Harold'" <elharo AT metalab.unc.edu>, "'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 12:30:07 +0100

> 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.

If you're trying to generate XHTML that follows the compatibility guidelines
for legacy HTML browsers, then empty elements that can never have content
(for example hr, br) should be written as <hr />, while those that could
have content (for example p) should be written as <p></p>. For details see
the XSLT 2.0/XQuery 1.0 serialization spec.

Michael Kay
http://www.saxonica.com/





Archive powered by MHonArc 2.6.24.

Top of Page