Re: Viewport and nested selected nodes

Richard Tobin wrote:
> [Catching up on mail, so this is a bit late.]
> 
>> Having to choose between:
>>
>> A) <p:viewport> and <p:for-each> are consistent. They are both
>> guaranteed to stream, so they can both be used on large documents.
>> B) <p:for-each> uses XPath and iterates over all the nodes so it can
>> be used to handle directly your use case.
>>
>> I would go with A.
> 
> Match patterns aren't necessarily streamable.  You can put any
> expression in a predicate, e.g. a[@b = /x/y/z].  Unless the patterns
> are very restricted, implementations that want to stream are going to
> have to analyse them anyway to determine whether they are streamable.

The analysis is limited to predicates.  That's a big win for streaming.

In addition, the pattern a[@b = /x/y/z] can be streamed with a bounded
cache.  The actual size of the cache will vary depending on the document
but for reasonable predicates and instance combinations, it doesn't
grow to the whole document.

Obviously, a pipeline author can completely blow it in terms of
streaming if the do something like the above and the 'z' element is
near the end of the document.

--Alex Milowski

Received on Thursday, 2 November 2006 15:43:49 UTC