Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Subclassing Serializer

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: John Cowan <jcowan AT reutershealth.com>
  • To: elharo AT metalab.unc.edu (Elliotte Rusty Harold)
  • Cc: xom-interest AT lists.ibiblio.org (xom-interest)
  • Subject: Re: [XOM-interest] Subclassing Serializer
  • Date: Mon, 7 Oct 2002 16:50:30 -0400 (EDT)

Elliotte Rusty Harold scripsit:

> I've been looking at how much a subclass of Serializer should be able to
> do and actually can do. The speciifc context is an effort to write a
> Serializer subclass that outputs canonical XML. Here's what I've discovered:

Here are some more use cases to guide your thinking:

An HTML Serializer that knows which HTML elements are empty
and generates SGML-style empty tags for them.

A Serializer that discards markup, outputting only text.

A wrapping Serializer that wraps inside markup only, leaving the
Infoset unchanged.

A PYX-format (ESIS-format) Serializer.

A Serializer that generates LMNL syntax.

A Serializer that generates YAML syntax.

> 2. It is not currently possible to change the way data is output at
> sub-node level. For instance, the subclass cannot choose to lexically
> order the attributes as required by canonical XML or decide what does
> and does not go into a CDATA section.

IOW, it cannot do so without overriding whole nodes.

> protected void writeMarkup(String s)
> protected void writePCDATA(String s)

I like this idea, and would add:

writeStartTag, writeEndTag, writeEmptyTag, writePITarget, writePIContent,
writeProlog, writeEpilog.

--
All Gaul is divided into three parts: the part John Cowan
that cooks with lard and goose fat, the part www.ccil.org/~cowan
that cooks with olive oil, and the part that www.reutershealth.com
cooks with butter. -- David Chessler
jcowan AT reutershealth.com




Archive powered by MHonArc 2.6.24.

Top of Page