Skip to Content.
Sympa Menu

xom-interest - RE: [XOM-interest] XOM 1.1: XPath

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: "Michael Kay" <mike AT saxonica.com>
  • To: "'Elliotte Harold'" <elharo AT metalab.unc.edu>
  • Cc: 'xom-interest' <xom-interest AT lists.ibiblio.org>
  • Subject: RE: [XOM-interest] XOM 1.1: XPath
  • Date: Fri, 7 Jan 2005 12:46:12 -0000

>
> I'll pay the 10% in performance to get 1% in correctness.

Most people will say that, but they'll forget they said it when they compare
benchmark results :-(
>
> OK. I've looked at the code and it seems like we could wrap
> an array or
> list of several Text objects as a single SAXON Node.

Yes, it's certainly doable in principle.

> However, I'm not
> sure how we'd feed the document into SAXON inn the first
> place. Where's the class that reads through a XOM Document and wraps
everything?

That's not the way it works. The wrappers are created on demand. You start
by creating a wrapper for the Document node and supplying that as a Source
object to Saxon. Then when any XPath expression navigates from that Document
node, or from any other wrapped XOM node, it creates wrappers for the nodes
that it finds, and returns those wrappers. To reduce the cost, a node that
is reached by downward selection retains a reference to the wrapper for its
parent, but in other cases no attempt is made to reuse the wrappers when the
same node is accessed multiple times (I did some experiments a long time ago
that led me to do it that way, though the results are not necessarily
conclusive today: it's based on the premise that in a typical XSLT
transformation each node is touched about once.)


> This might require some changes to Saxon internals but it should help
> out with JDOM as well. What about DOM? Does SAXON also not merge
> adjacent text nodes there?

The same problem applies to JDOM and DOM. I would probably handle it through
another level of VirtualNode, which could be used by all three mappings.

Michael Kay





Archive powered by MHonArc 2.6.24.

Top of Page