Project

Profile

Help

Bug #3636

closed

Obtaining the full context sequence

Added by Michael Kay over 6 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Diagnostics
Sprint/Milestone:
-
Start date:
2018-01-22
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
9.8, trunk
Fix Committed on Branch:
9.8, trunk
Fixed in Maintenance Release:
Platforms:

Description

In earlier Saxon releases, it was possible to obtain the full sequence of items containing the focus (context item, position and size) because the SequenceIterator interface provided a method getAnother() allowing a new iterator to be obtained, returning the same items, but positioned at the start of the sequence. This method was used mainly to implement the last() function, but it was also used by some third-party tools to provide debugging support.

The getAnother() method has been dropped in 9.8. This was partly because it was difficult to provide it for all iterators (for example, iterators accessing streamed input) and also because some implementations of the method had problems caused by evaluating expressions more than once (which in unusual cases might not deliver the same result each time).

To retain the debugging capability we are considering a different mechanism, that allows the FocusTrackingIterator maintained to represent the focus in most cases to retain the full focus sequence rather than just the values of context item, position, and last.

Actions #1

Updated by Michael Kay over 6 years ago

  • Status changed from New to In Progress
  • Priority changed from Low to Normal

First, if the facility is switched on, then a FocusTrackingIterator will be backed by a MemoSequence which remembers the items it has read and makes them available on request. The switch for this will (in 9.8) be a "final static" variable, set to false() by default, so the feature is only available in a version of the code compiled for debugging.

It won't work for iterators that require additional context information to be maintained, notable for GroupIterator and RegexIterator.

It turns out that the materialize() and getResidue() methods of MemoSequence need to be improved because they currently disturb the current state of the iterator (specifically, they swallow the rest of the sequence).

Actions #2

Updated by Michael Kay over 6 years ago

In 9.8, the facility is switched on using static variables in the FocusTrackingIterator class.

In 9.9, we introduce a new method XPathContext.trackFocus() which creates the FocusTrackingIterator and sets it as the current iterator for the context; this method invokes a factory method defined in the Controller which is used to instantiate a new FocusTrackingIterator, and which can be overridden by setting a different factory method in the Controller.

Actions #3

Updated by Michael Kay over 6 years ago

  • Status changed from In Progress to Resolved
  • Applies to branch 9.8, trunk added
  • Fix Committed on Branch 9.8, trunk added
Actions #4

Updated by O'Neil Delpratt about 6 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 9.8.0.8 added

Bug fix applied in the Saxon 9.8.0.8 maintenance release.

Please register to edit this issue

Also available in: Atom PDF