Internal changes
As might be expected, the Saxon code has undergone major change internally, which will affect any application making significant use of internal interfaces. Here are some of the highlights:
- The NodeEnumeration class is replaced with SequenceIterator. This is modelled on the JDK 1.2 Iterator interface, and can return any sequence of Items. An Item is either a SimpleValue or a NodeInfo.
- Added the getAnother() method to the SequenceIterator interface. This means all SequenceIterators can clone themselves to produce another SequenceIterator of the same nodes. (But it's not a pure Java clone, because the new iterator is positioned at the start of the sequence.) The implementation of last() has changed: if the SequenceIterator doesn't know how many nodes there are in the sequence, the iterator is cloned and the items are counted, without being saved in memory as previously. This should only happen once for any given iterator, so in general calling last() causes a node-set to be scanned twice.
- The Step class has been removed. A step that is a simple unfiltered axis expression is now represented by an AxisExpression; a step with filters is represented by a FilterExpression, and any other kind of expression may also now be used in a PathExpression.
- An important new internal class is the MappingIterator. This maps one sequence to
another sequence by invoking a MapppingFunction on each member of the first sequence.
This capability is now used to implement both path expressions and
for
expressions. It is also used in various other contexts, e.g. in the implementation of the document(), key() and id() functions. - The asString method on Value is renamed
getStringValue
, this allows both SimpleValues and Nodes to implement the new Item interface, which represents a member of a sequence. - Internal changes in support of datatypes: I removed evaluateAsDouble(), etc,
and replaced them with a generic method
evaluate(context, requiredType), which always returns a Value. A new
package,
net.sf.saxon.value
, now contains all the data-type related classes. - The functions key(), id(), and document() are now fully pipelined, that is, they deliver an iterator over the result nodes.
- The classes that handle sorting have been totally rewritten, partly to handle general sequences, and partly to use collations.
- The Context class has changed. There are now two separate classes, XSLTContext and XPathContext. There is only one XSLTContext object used during a transformation (the information could have been held in the Controller itself). Stacking of values in the XSLT context uses the Java program execution stack, in the sense that any routine that sets a new value has to remember the old value and reset it on completion. The XPath context, by contrast, still creates a new instance every time a new value is stacked. This essentially just wraps the SequenceIterator that represents the context node list. The SequenceIterator itself is responsible for returning current item and current position.
I have removed documentation of the saxon:trace extension attribute; it seems this hasn't been working for some time.