Changes specific to .NET

The XsltExecutable object has a new Explain() method that gives a diagnostic representation of the compiled code (as an XML document).

The Equals() and GetHashCode() methods on XdmNode are now defined so that two XdmNode instances are equal if and only if they represent the same node (that is, they reflect the XPath "is" operator).

The XPathCompiler object now has the ability to maintain a cache of compiled XPath expressions. If this feature is enabled, any attempt to compile an expression first causes a lookup in the cache to see whether the same expression has already been compiled. The cache is cleared if any changes to the static context are made (for example, changing the namespace declarations in force).

The XPathCompiler object has two new convenience methods, Evaluate() and EvaluateSingle(), allowing an expression to be compiled and executed with a single call. This works especially well when the compiler is also caching compiled expressions.

The error handling in the XPath API has been improved so that static and dynamic errors occurring during XPath evaluation now result in a Saxon.Api.StaticError or Saxon.Api.DynamicError being thrown, rather than exposing the underlying Java exceptions.

The XQueryEvaluator has a new method CallFunction that allows any user-declared function within the compiled query to be called directly from the Java application. This in effect enables the creation of a query library containing multiple functions that can be invoked from the calling application. Note that to compile a query, it must still have a "main query" to satisfy the syntax rules of the XQuery language.

There is a new overload of DocumentBuilder.Build() that allows the XML document to be supplied from a TextReader rather than a stream (including a StringReader, which makes it easier to build from XML held as a string literal).