Re: [bdbxml] XMLInputStreams and regular InputStreams and w3c DOM objects.

John Snelson <[email protected]> Wed, 28 Sep 2005 16:40:20 +0100
Newsgroups gmane.comp.db.dbxml.general
Message-ID <[email protected]>
Mark R. Diggory wrote:
> Saxon has an SPI layer for transforming object models other than w3c 
> DOM. Implementing this for the BDBXML java API would mean that one can 
> write an JAXP transform directly on XMLValue nodes instead of having to 
> convert them to w3c DOM first. (Very Cool).

Hmmm. Saxon implements XSLT and XQuery - both of which are functional 
languages that do not actually modify their input data. DB XML, on the 
other hand, benefits from the user actually performing modifications to 
the document tree themselves, as it can then perform efficient partial 
updates of  documents.

It would probably be just as efficient to have Saxon's output translated 
into the event API, when we have completed that.

> Finally, do you guys have an answer for my question? It was buried 
> pretty deep in the message, so I understand it getting missed:
> 
>>>>> Question: When completing an XMLQuery against the DB, are the 
>>>>> results in memory (as XMLValues) at execution or are they completed 
>>>>> as I iterate over the XMLResult? The question is more specifically, 
>>>>> If I can do something like "result.next(doc);" is the XMLDocument 
>>>>> just backed by the in-memory XMLValue DOM or is it backed directly 
>>>>> by the Database?

I think there are two questions here - or at least, I have two answers 
for it ;-).

The XmlValue objects that you retrieve from the XmlResults can be 
calculated lazily - in other words, the next one does not exist until 
you call XmlResults.next(). This is acheived by setting 
XmlQueryContext.setEvaluationType(XmlQueryContext.Lazy).

The second answer is that if you are using the NodeContainer storage 
model, then the actual document is not all retrieved at once. Nodes will 
only be retrieved from the database when the query needs them, or as 
needed when the methods on XmlValue are called (like getFirstChild(), 
getNextSibling() etc.).

I hope this helps,

John

-- 
John Snelson, Berkeley DB XML Engineer
Sleepycat Software, Inc
http://www.sleepycat.com

Contracted to Sleepycat through Parthenon Computing Ltd
http://blog.parthcomp.com/dbxml


------------------------------------------
To remove yourself from this list, send an
email to [email protected]