[XML-SIG] qp_xml API (was: DOM API)

Ken MacLeod ken@bitsko.slc.ut.us
23 Apr 1999 17:11:01 -0500


Greg Stein <gstein@lyra.org> writes:
> Parser.parse(input): input may be a string or an object supporting
> the "read" method (e.g. a file or httplib.HTTPResponse (from my new
> httplib module)). The input must represent a complete XML
> document. It will be fully parsed and a lightweight representation
> will be returned. This method may be called any number of times (for
> multiple documents). The returned object is an instance of
> qp_xml._element.

It was suggested in an earlier thread that multiple builders should be
allowed for.

A technique for implementing this is to take the `parse' function out
of the tree class altogether and put tree builders into their own
classes.

There is very little functional difference between the two (i.e. all
you're doing is moving the `parse' function you have into a different
class, it still returns a tree), but the semantic difference of ``who
can build a tree'' becomes very clear.

This can be very useful for the DOM and DOM-subset packages being
talked about elsewhere.  For example, a DOM-builder that takes SAX
events and calls DOM-factory methods to build a tree can be used to
build any of the DOM trees.

-- 
  Ken MacLeod
  ken@bitsko.slc.ut.us