[XML-SIG] qp API

Paul Prescod paul@prescod.net
Fri, 23 Apr 1999 11:55:08 -0500


Greg Stein wrote:
> 
> Actually: that is a good point.... what is "lightweight" ? I define that
> as something that is fast, has a small set of objects, and has a small
> interface (few objects/methods).
> 
> A question was asked: do we need Yet Another Interface? I believe that we
> do. IMO, the qp interface is very well tuned towards apps being able to
> interpret what is really going on when an XML doc arrives (yes, within
> certain constraints). IMO, the DOM is great for translations of input XML
> to output XML. But someting like qp is handy for grabbing input and
> dealing with it (I was never able to really do that well with the DOM).

I hear three different issues:

 * performance
 * size of interface
 * walking-around convenience

I think that a lightweight DOM implementation can go a long way toward
meeting these requirements.

Performance: 

If we take out parent and sibling pointers, I see know reason that a DOM
implementation should be more than a few percent slower than qp_xml. In
the minidom implementation I am working on, 60% of the code and probably a
big chunk of the runtime is dedicated to the stupid^H^H^H^H^H^H
inconvenient namespace processing. If we're both doing namespace
processing we will both incur that overhead. Even with namespaces, whole
thing is less than 300 lines of code!

Size of interface: 

Minidom has 3 builder methods (building from strings, files and filenames)
and 6 runtime classes -- only one of which is even mildly complex (again,
because of namespace handling) If you are handling simple documents
without PIs and comments  then you only need to deal with three classes:
document, element and text. In other words the interface that most people
will use is rather small.

convenience:

We can add convenience functions that allow people with different
interests to find the information that they need in an XML document.
Convenience functions add to the interface but they don't really affect
performance much. So far I have identified a need to be able to iterate
over the elements, find a child element by its type name and deeply
conctenate the text of a node. What else?

-- 
 Paul Prescod  - ISOGEN Consulting Engineer speaking for only himself
 http://itrc.uwaterloo.ca/~papresco

"The Excursion [Sport Utility Vehicle] is so large that it will come
equipped with adjustable pedals to fit smaller drivers and sensor 
devices that warn the driver when he or she is about to back into a
Toyota or some other object." -- Dallas Morning News