Changes specific to .NET
SaxonCS adds support for LINQ documents (XDocument
class) alongside DOM support. The DocumentBuilder has new methods to allow building from a LINQ source, or wrapping a LINQ node as an
XDM node, and a new LinqDestination class allows the result of a query or transformation to be
written to a LINQ tree.
With this feature, it becomes possible to run XPath 3.1 queries against LINQ documents, returning nodes in the original LINQ tree.
A number of changes have been made to simplify the use of item types and sequence types (particularly useful when defining extension functions):
-
Added the properties XdmItemType.One, XdmItemType.OneOrMore, XdmItemType.ZeroOrMore, and XdmItemType.ZeroOrOne as a convenient way of constructing a sequence type from an
ItemType
and an occurrence indicator. -
Added the method XdmSequenceType.Matches(XdmValue) to test whether a value matches a sequence type.
-
Added Equals() and GetHashCode() methods to XdmItemType and XdmSequenceType so equivalent types compare equal.
-
Cleaned up and documented the behavior of
ToString()
applied to item types and sequence types. In particular, XdmItemType.ToString() now uses the formxs:boolean
rather thanQ{http://www.w3.org/2001/XMLSchema}boolean
for the common case of names in thexs
namespace. - Added a static method XdmItemType.ForItem() to get the item type of an item (see the .NET API documentation for exactly what this means).
-
XdmNode has a new property TypeAnnotationName which returns the name of the type annotation of the node
(defaulting to
xs:untyped
andxs:untypedAtomic
for elements and attributes that have not been schema-validated).
The serializer now accepts any encoding known to .NET (specifically, any encoding recognised by Encoding.GetEncoding()
,
after calling Encoding.RegisterProvider(CodePagesEncodingProvider.Instance)
to enable use of the full set of
encodings known to the platform).
Added the property XdmNode.OutermostElement to find the outermost element (also known as the document element) of a tree.
In 12.4, added an ErrorReporter
property to classes
XQueryEvaluator
, XsltTransformer
, and Xslt30Transformer
,
allowing dynamic errors and warnings to be intercepted and notified somewhere other than the system
error stream.