System Programming Interfaces

"System programming" interfaces are those interfaces that might be used by advanced applications, perhaps by code integrating Saxon within other products, but are unlikely to be used by typical user-written application code.

The Receiver interface (widely used internally within Saxon) has changed to reduce the dependency on the NamePool. On the startElement() and attribute() calls, the names and types of elements and attributes are now passed as object references rather than integer codes. Similarly on the namespace() call, the integer namespace code is replaced with a reference to a NamespaceBinding object.

Integer namespace codes allocated from the name pool are no longer used. They have been replaced with the NamespaceBinding object which contains the prefix and URI as strings. The purpose of this change is to reduce the number of synchronized calls on the NamePool, and hence to reduce contention; the performance benefit from avoiding string comparisons did not justify the overhead caused by synchronization. This change results in small changes to both the NodeInfo and Receiver interfaces.

A new method getSchemaType() is added to the NodeInfo interface, returning the type annotation as a SchemaType object. The existing getTypeAnnotation() method which returns the same information as an integer fingerprint remains available for the time being.

The mechanism for injecting trace calls into expressions has been generalised so that an arbitrary CodeInjector can be supplied. This can be selective about what kind of expression it inserts into the parse tree, and where. This gives a lot more flexibility for tools that add debugging or performance monitoring capabilities to the product. For XQuery this can be controlled at the level of the StaticQueryContext, for XSLT using the CompilerInfo object.

In the expression tree, the representation of path expressions and axis expressions has changed. The class PathExpression has disappeared; instead, the class SlashExpression is used, wrapped in a DocumentSorter if sorting into document order and elimination of duplicates is required. A subclass of SlashExpression, the SimpleSlashExpression, is used for expressions of the form $p/title where the left-hand side selects a singleton and the right-hand side is an axis expression; this optimization reduces the number of context objects that need to be created, especially in XQuery where such constructs are very common.