cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rob Parker" <rob...@webcybernetics.com>
Subject Re: SAX Event cacheing & Generators
Date Fri, 05 May 2000 02:38:29 GMT

----- Original Message -----
From: Williams, Murray Todd <murray_williams@merck.com>
To: <cocoon-dev@xml.apache.org>
Sent: Friday, May 05, 2000 12:11 AM
Subject: RE: SAX Event cacheing & Generators


> I must confess I'm just now starting to play directly with the DOM and SAX
> APIs, so I'm not perfectly clear on how the "instance callbacks" and
"static
> callbacks" system is implemented.  Does a different customized class have
to
> be created for each document DTD that you wish to serialize, or is it
> possible to write a generic utility class that would serialize and
> deserialize from SAX to a binary stream?
>

You need to look at the SAX Handler interface docs. These specify an
interface
which is a 'contract' between your client class and the parser. The parser
is
responsible for notifying your client class (via callbacks) with calls such
as
start document, end document, start element, end element etc. The arguments
to these methods contain the document specific details - eg the element name
etc.
Hence the interface API's are very generic.... Thus you can build a custom
handler class
which will work for any document.

AFAIK the SAX Handler api only supports instance method callbacks - ie this
is
what interfaces are all about. Now the parser doesn't know or care what you
do inside
your callback methods. Hence I had a parser client which built my list of
static calls. Because
I built the client class, I can do anything I want :-) Once I have my list
of *my own callbacks*,
I can replay, splice, merge it at will.



Rob


Mime
View raw message