Changes specific to .NET
In SaxonCS, the broad structure of the API remains unchanged from the older .NET product, including some features retained for legacy reasons, but the detail has been modernized and made more consistent.
XmlDestination is renamed as IDestination,
firstly to use the standard naming convention for interfaces, and secondly to reflect the fact that the content
sent to an
IDestination is not always XML.
TextWriterDestination is renamed as XmlWriterDestination to better reflect its purpose and usage.
The value of property XdmNode.NodeKind is now an
XdmNodeKind, and the corresponding
XmlNodeType is obtained using the new XdmNode.NodeType property
(the need for both arises because there isn't an exact correspondence between node types in DOM and node
kinds in XDM.)
XdmItem.GetStringValue() is replaced with a property XdmItem.StringValue.
There have been some changes to the API for declaring collections.
Saxon.Api.IPredicate have gone,
replaced by use of
System.Predicate. All the predicates obtained using the Saxon.Api.Predicates
factory class (e.g.
Predicates.IsElement()) remain available.
It's now possible to use a lambda expression wherever a predicate was expected,
e.g. as the argument to
It's no longer possible to combine predicates using
P.Or(Q). Instead you can do
Predicates.AllOf(P, Q, R, ...) or
Predicates.AnyOf(P, Q, R, ...).
Also it's no longer possible to define a subclass of
but there's not much of a use case for doing that anyway.
A number of callbacks have been changed from interfaces to delegates, allowing them to be implemented more
conveniently as lambda expressions. These include
the CollectionFinder, the ErrorReporter, and the XQueryResolver (module resolver).
The class SimpleUriResolver is an implementation of the .NET-defined
XmlResolver that allows the actual resolution logic to be written as a lambda expression,
XmlResolver resolver = new SimpleUriResolver(uri => new WebClient().OpenRead(uri)).
The classes SchemaValidator, XQueryCompiler, and XsltCompiler no
longer have an
ErrorList property. To accumulate error details in a list, change the declaration of
the error list to
IList<Saxon.Api.Error>, and replace
compiler.ErrorReporter = errorList.Add;.
The ValidationFailure object which provides information about errors
detected during schema validation now delivers information about the error in the form of C# properties rather
than Java-like methods: for example
A number of getter and setter methods (such as
ValidationFailure.GetLineNumber()) have been changed
ValidationFailure.LineNumber in this case.