On Wednesday, 10/31/2001 at 09:20 CST, "Montowski, Ken"
<[EMAIL PROTECTED]> wrote:
> I am using Xalan and understand that DTM was a wrapper around the DOM

DTM is an abstract API for the XPath data model. DOM2DTM is an
implementation of that API as a wrapper around a DOM. SAX2DTM is an
implementation of that API around data structures designed for it from the
gound up.


> what caught my eye in my reading was the fact that DTM builds indices for
> searching where DOM uses string compares

DTM works with a combined "extended node type" integer which represents the
combination of an equivalent of the DOM node type, the node's Local Name
(if any), and the node's Namespace URI (if any). That does make checking
what role a node is playing significantly faster than checking these three
values simultaneously.

Our DTM implementations also preconstruct some index tables which speed up
the task finding all nodes having the same extended type.

If these are what you're after, it might be more efficient for you to just
implement these concepts rather than using the full-blown DTM. DOM2DTM in
particular has to replicate a considerable amount of the information
contained in each DOM node. We hope to get away from that at some point...
but there's a reason we recommend that people drive Xalan with SAX rather
than DOM if possible; SAX2DTM is considerably more space-efficient.


> The problem I see is that Xerces XPATHAPI is taking an average of 3 secs
to
> parse the DOM...   I need to speed this search time up.

I'd strongly suggest that you run a performance analyser over your code
before assuming that DOM construction is the dominant factor. I'd also
suggest you talk to the Xerces folks about this, since you may have exposed
a bottleneck in their code and/or missed a performance opportunity.

> I was hoping to at least get some examples of how to implement DTM

I'm afraid the only working code examples we have of DTM implementations
are DOM2DTM and SAX2DTM, and the only examples we have of using these are
Xalan itself and a few tiny test harnesses (TestDTM) we used while
debugging those classes. And the DTM API should probably not yet be
considered completely stable; we're still looking at potential refinements.

Reply via email to