XQuery implementatino: context and doc()
Added by Anonymous over 16 years ago
Legacy ID: #4943136 Legacy Poster: David Lee (daldei)
In saxon xquery, are the context and doc() documents read into memory or are they streamed ? I'm working on an implementation of "xcat" which will concatentate a list of documents into one xml document. I'd like to avoid reading any of the input documents entirely into memory (DOM style) rather I'd like to stream them. If I set a document as the context (say using StreamSource) or as a file argument to doc() will they be read into memory before processing ? Is there a recommended way to let xquery not read documents into memory before processing. Is it intrinsic on the way documents are accessed ? or does it depend on the xquery expressions ? For example: If I use following xquery <doc> { doc("file.xml"); } </doc> would "file.xml" be read fully into memory ? or is it streamed ? Similarly <doc> { /* } </doc> or say <doc> { for $file in $all_files return doc($file)/* } </doc> or say the slightly more complex <doc> { for $file in $all_files return for $root in doc($file) return $root/root/* } </doc> Is there a particular expression or use that cauess the entire document to be read into memory ? or is it done always. Thanks for any hints or suggestions. -David Lee dlee@calldei.com www.xmlsh.org
Replies (1)
RE: XQuery implementatino: context and doc() - Added by Anonymous over 16 years ago
Legacy ID: #4943316 Legacy Poster: Michael Kay (mhkay)
Currently in XQuery all documents are fully read into memory, unless you use the document projection facilities described at http://www.saxonica.com/documentation/sourcedocs/projection.html which allow the constructed tree to contain only that subset of the document actually used by the query. There are limited facilities in XSLT for streamed processing, see http://www.saxonica.com/documentation/sourcedocs/serial.html and I plan to introduce something similar for XQuery in the next release. Michael Kay http://www.saxonica.com/
Please register to reply