On 13/10/2011 15:11, Rehan wrote:
Hello,

Is it possible that using the new streaming feature of Saxon 9.3 EE, we can pick the values of the some attributes in the root node where the source document is too large?

Example:

<Export ExtractedDate='12/10/2011' Batch='32323'>

<so many child nodes inside, that made up the source document size more than 300 MB>

</Export>

Now, I want to get the values of "ExtractedDate" and "Batch" attributes without loading the full document in the memory, is it possible somehow? any examples please?


Yes, this is possible. I'll need to do an experiment before I can be 100% confident that a particular approach works, but I should try

saxon:stream(doc('abc.xml')/Export/@*)

and see if it has the desired effect.

In streaming mode, Saxon attempts to abort parsing if it can tell that no further data is required, but the exact circumstances where this applies might depend on how the query is written.

Michael Kay
Saxonica