Saxon.Api

 

 

Saxon.Api - the SaxonCS Application Programming Interface for .NET

This namespace contains Saxon's application programming interfaces for using XSLT, XQuery, XPath and XSD on .NET.

The top-level object is the Processor; this allows creation of factory classes for using each of the different processing languages.

The classes are all found in the assembly: saxoncs.dll.

Further background information about this API is available at https://www.saxonica.com/html/documentation12/saxon-cs/dotnetapi.html

 

Interface Summary

Name Description
IDestination

An abstract destination for the results of a query or transformation.

IInvalidityHandler

Interface for reporting validation errors found during validation of an instance document against a schema.

IProcessorInitializer

An interface that can be implemented by the user to supply a callback for use in the -init option on the command line.

IResource

This interface defines a Resource, which might be an external XML file, text file, JSON file, etc. Resources might belong to a collection, or might be accessed individually by URI.

 

Delegate Summary

Name Description
CollectionFinder

An CollectionFinder can be registered with the Processor; it is called in response to calls on the fn:collection() and fn:uri-collection() functions. When these functions are called, the delegate is called to get a collection of IResource objects representing resources identified by the supplied collection URI.

ErrorReporter

The ErrorReporter is a generic interface for reporting errors and warnings.

ResourceResolver

The ResourceResolver is a generic callback interface for resolving URIs referring to resources.

ResultDocumentHandler

A ResultDocumentHandler can be nominated to handle output produced by the xsl:result-document instruction in an XSLT stylesheet. The function is called by the XSLT processor when an xsl:result-document with an href attribute is evaluated.

SchemaResolver

The SchemaResolver is a user-supplied class used for resolving references to schema documents. It applies to references from one schema document to another appearing in xs:import, xs:include, and xs:redefine; to references from an instance document to a schema in xsi:schemaLocation and xsi:noNamespaceSchemaLocation, to xsl:import-schema in XSLT, and to the import schema declaration in XQuery.

XQueryResolver

Given a module URI and a set of location hints, return a set of query modules.

 

Class Summary

Name Description
DocumentBuilder

The DocumentBuilder class enables XDM documents to be built from various sources. The class is always instantiated using the NewDocumentBuilder method on the Processor object.

DomDestination

A DomDestination represents an XmlDocument that is constructed to hold the output of a query or transformation.

DynamicContext

The class DynamicContext provides information about the dynamic context of an expression

Error

The Saxon.Api.Error class contains information about an error detected during compilation or execution of a stylesheet, query, XPath expression, or schema. Note that this class is not an exception (though in some cases it may wrap an exception); errors in schemas or stylesheets are considered as normal events and do not cause termination of processing, so they are not delivered as exceptions.

ExtensionFunctionCall

An instance of this class will be created by the compiler for each function call to this extension function that is found in the source code. The class is always instantiated by calling the method MakeFunctionCall() of the corresponding ExtensionFunctionDefinition. The implementation may therefore retain information about the static context of the call. Once compiled, however, the instance object must be immutable.

ExtensionFunctionDefinition

Abstract superclass for user-written extension functions. An extension function may be implemented as a subclass of this class, with appropriate implementations of the defined methods.

More precisely, a subclass of ExtensionFunctionDefinition identifies a family of extension functions with the same (namespace-qualified) name but potentially having different arity (number of arguments).

Feature

Feature defines a set of constants, representing the details of Saxon configuration options which can be supplied to the Saxon method Processor.SetProperty(), and to other interfaces.

FeatureKeys

FeatureKeys defines a set of constants, representing the names of Saxon configuration options which can be supplied to the Saxon implementations of the JAXP interfaces TransformerFactory, SchemaFactory, Validator, and ValidationHandler, and to other interfaces such as the s9api net.sf.saxon.s9api.Processor

JsonBuilder

A JsonBuilder allows XDM values (typically maps and arrays) to be constructed by parsing JSON input

LinqDestination

A LinqDestination represents a LINQ-for-XML XDocument that is constructed to hold the output of a query or transformation.

Location

A Location represents the location of a construct within a containing resource. For example, it might identify the location of an error in a schema document, stylesheet module, or query module, or the location of an element that fails schema validity checking.

Message

A Message represents the output of an xsl:message or xsl:assert instruction.

NamespaceConstant

Holds a set of constants representing known namespaces.

NodeResource

An implementation of IResource that represents an XDM node, simply by wrapping an existing XdmNode object

NullDestination

A NullDestination is an XmlDestination that discards all its output.

ParameterDetails

Information about an external parameter to an XSLT stylesheet (xsl:param) or an XQuery query (declare variable ... external;)

Predicates

This non-instantiable class provides a number of useful implementations of the System.Predicate interface, designed for use when navigating streams of XDM items.

Processor

The Processor class serves three purposes: it allows global Saxon configuration options to be set; it acts as a factory for generating XQuery, XPath, and XSLT compilers; and it owns certain shared resources such as the Saxon NamePool and compiled schemas.

QName

The QName class represents an instance of xs:QName, as defined in the XPath 2.0 data model. Internally, it has three components, a namespace URI, a local name, and a prefix. The prefix is intended to be used only when converting the value back to a string.

RawDestination

A RawDestination is an Destination that accepts a sequence output by a stylesheet or query and returns it directly as an XdmValue, without constructing an XML tree, and without serialization. It corresponds to the serialization option build-tree="no".

ResourceRequest

A bundle of information made available when requesting resource resolution using a ResourceResolver. Any of its properties may be absent.

SaxonApiException

The SaxonApiException class contains information about a static or dynamic error detected during compilation or evaluation of a stylesheet, query, or XPath expression, or other errors that occur when using the Saxon API.

SchemaManager

A SchemaManager is responsible for compiling schemas and maintaining a cache of compiled schemas that can be used for validating instance documents.

SchemaValidator

A SchemaValidator is an object that is used for validating instance documents against a schema. The schema consists of the collection of schema components that are available within the schema cache maintained by the SchemaManager, together with any additional schema components located during the course of validation by means of an xsl:schemaLocation or xsi:noNamespaceSchemaLocation attribute within the instance document.

Serializer

A Serializer takes a tree representation of XML and turns it into lexical XML markup.

StaticContext

The class StaticContext provides information about the static context of an expression.

Step

A Step represents a function from an XDM item to a sequence of items. Steps are most commonly used as the argument to the method XdmValue.Select(). A wide selection of system-defined steps are available from static methods of the Saxon.Api.Steps class. It is possible, however, to create user-defined Steps.

Steps

This non-instantiable class provides a number of useful implementations of the Step class. For example, Steps.Child() returns a Step which can be used as an argument to the XdmValue.Select() method, in order to select the children of an XDM node.

TextResource

An implementation of IResource that represents plain text

ValidationFailure

This object represents a failure detected when validating an instance against a type defined in a schema.

WhitespacePolicy

WhitespacePolicy is a class defining the possible policies for handling whitespace text nodes in a source document.

XdmAnyArrayType

Singleton class representing the item type array(*), which matches any array.

XdmAnyFunctionType

Singleton class representing the item type function(*), which matches any function item.

XdmAnyItemType

Singleton class representing the item type item(), which matches any item.

XdmAnyMapType

Singleton class representing the item type map(*), which matches any map.

XdmAnyNodeType

Singleton class representing the item type node(), which matches any node.

XdmArray

The class XdmArray represents an array item in an XDM 3.1 sequence: this is a new kind of item in the XDM data model. An array is a list of zero or more members, each of which is an arbitrary XDM value. An array is also a function: it maps a positive integer to the array member found at that position in the array.

XdmAtomicType

An instance of class XdmAtomicType represents a specific atomic type, for example xs:double, xs:integer, or xs:anyAtomicType. This may be either a built-in atomic type or a type defined in a user-written schema.

XdmAtomicValue

The class XdmAtomicValue represents an item in an XDM sequence that is an atomic value. The value may belong to any of the 19 primitive types defined in XML Schema, or to a type derived from these primitive types, or to the XDM-specific type xs:untypedAtomic.

XdmDestination

An XdmDestination is a Destination in which an XdmNode is constructed to hold the output of a query or transformation: that is, a tree using Saxon's implementation of the XDM data model.

XdmEmptySequence

The class XdmEmptySequence represents an empty sequence in the XDM Data Model.

XdmExternalObject

An XdmItem that wraps an external .NET object.

XdmFunctionItem

The class XdmFunctionItem represents an item in an XDM sequence that holds a function.

XdmItem

The class XdmItem represents an item in a sequence, as defined by the XDM data model. An item may be an atomic value, a node, a function (including maps and arrays), or an external object.

XdmItemType

Abstract class representing an item type. This may be the generic item type item(), an atomic type, the generic node type node(), a specific node kind such as element() or text(), or the generic function type function().

XdmMap

The class XdmMap represents a map item in an XPath 3.1 sequence: this is a new kind of item in the XDM data model. A map is a list of zero or more entries, each of which is a pair comprising a key (which is an atomic value) and a value (which is an arbitrary value).

XdmNode

The class XdmNode represents a Node in the XDM Data Model. A Node is an XdmItem, and is therefore an XdmValue in its own right, and may also participate as one item within a sequence value.

XdmNodeKind

Instances of XdmNodeKind represent the item types denoted in XPath as document-node(), element(), attribute(), text(), and so on. These are all represented by singular named instances.

XdmSequenceType

An instance of class XdmSequenceType represents a sequence type, that is, the combination of an item type and an occurrence indicator.

XdmValue

A value in the XDM data model. A value is a sequence of zero or more items, each item being an atomic value, a node, or a function item.

XmlReaderResource

An implementation of IResource that contains the ingredients to construct an XDM node, supplied in the form of a DocumentBuilder and an XmlReader representing an XML parser that can be called upon to construct the node when required

XmlWriterDestination

An XmlWriterDestination is an implementation of XmlDestination that wraps an instance of XmlWriter.

XPathCompiler

An XPathCompiler object allows XPath queries to be compiled. The compiler holds information that represents the static context for the expression.

XPathExecutable

An XPathExecutable represents the compiled form of an XPath expression. To evaluate the expression, it must first be loaded to form an XPathSelector.

XPathSelector

An XPathSelector represents a compiled and loaded XPath expression ready for execution. The XPathSelector holds details of the dynamic evaluation context for the XPath expression.

XQueryCompiler

The XQueryCompiler object allows XQuery queries to be compiled.

XQueryEvaluator

An XQueryEvaluator represents a compiled and loaded query ready for execution. The XQueryEvaluator holds details of the dynamic evaluation context for the query.

XQueryExecutable

An XQueryExecutable represents the compiled form of a query. To execute the query, it must first be loaded to form an XQueryEvaluator.

Xslt30Transformer

An Xslt30Transformer represents a compiled and loaded stylesheet ready for execution. The Xslt30Transformer holds details of the dynamic evaluation context for the stylesheet.

XsltCompiler

An XsltCompiler object allows XSLT stylesheets to be compiled. The compiler holds information that represents the static context for the compilation.

XsltExecutable

An XsltExecutable represents the compiled form of a stylesheet. To execute the stylesheet, it must first be loaded to form an XsltTransformer or Xslt30Transformer.

XsltPackage

An XsltPackage object represents the result of compiling an XSLT 3.0 package, as represented by an XML document containing an xsl:package element.

XsltTransformer

An XsltTransformer represents a compiled and loaded stylesheet ready for execution. The XsltTransformer holds details of the dynamic evaluation context for the stylesheet.

 

Enum Summary

Name Description
HostLanguage

Identifies a host language in which XPath expressions appear. Generally used when different error codes need to be returned depending on the host language.

SchemaValidationMode

Enumeration identifying the various Schema validation modes

TreeModel

Enumeration identifying the different tree model implementations

UnprefixedElementMatchingPolicy

An enumeration defining possible strategies for resolving unprefixed element names appearing as name tests in the steps of a path expression or XSLT match pattern

XdmAxis

Enumeration identifying the thirteen XPath axes

 

Exception Summary

Name Description
SaxonApiException

The SaxonApiException class contains information about a static or dynamic error detected during compilation or evaluation of a stylesheet, query, or XPath expression, or other errors that occur when using the Saxon API.