>I'm trying to figure out what would be most efficient from a memory
>perspective for feeding XOM data into Xalan. The options seem to be:
>
>1. A stream containing the XSLT stylesheet
>2. A SAX XMLReader that provides the XSLT stylesheet
>3. A DOM Document object that contains the XSLT stylesheet
>
>Then I need to ask the same three questions for input documents fed
>into the transform.

For the stylesheet: We always build an internal parse tree; if you hand us
a DOM, we have to rebuild the whole tree anyway. I'm not familiar with XOM,
but I'd guess that the most efficient solution if you've got the model
alreay in memory would be to use an XOM-to-SAX serializer and feed that
into Xalan via a SAXSource; that avoids conversion to and from XML syntax.
(If you happen to already have the data in DOM form, we'll read from that
to avoid your having to explicitly copy it into SAX form... but if you
don't, it's more efficient to start with a SAX source, since that's what
our parser's really built around.)

For the input document: Xalan's internal representation is currently DTM.
You might want to take a look at our DOM2DTM classes to see how we do a
"lighter-weight" implementation of DTM when given a DOM tree as input (or
at the experimental DOM2DTM2, which is even lighter weight but which relies
on the ability to bind annotations to the DOM nodes, which isn't supported
in all DOMs). You could use those as the basis for creating an XOM2DTM
layer, and an XOMSource to feed it. If you don't want to deal with plugging
in that custom source and model, see previous paragraph; our basic "native"
DTM is designed to be fed from SAX, so the next-most-efficient route from a
new variety of in-memory model into Xalan would be to create a SAX
serializer from that model.


DTM is a fairly decent back-end model -- considerably more compact than
DOM-like solutions -- but it's not a particularly good API for wrapping
around other models. In the lab, we've done some more work on the XDM idea,
which abstracts the document model somewhat better and could be more easily
wrapped around other data sources... but converting all of Xalan to use it
is a huge code disruption, and I don't *think* we've got a version ready to
post back to Apache. It would have to be considered a Major Release if/when
we brought it forward.

______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
"The world changed profoundly and unpredictably the day Tim Berners Lee
got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to