Saxon.Api

 

 

Saxon.Api

Delegate SchemaResolver


public delegate IResource SchemaResolver(string targetNamespace, Uri baseUri, Uri locationHint)

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.

If the SchemaResolver returns null, then the system attempts to locate a schema using the common resource resolver associated with the Saxon Configuration. It first attempts to resolve the location hint (if available), then the target namespace (if present and non-empty). If both attempts fail, the system then attempts to use standard URI resolution mechanisms to resolve the location hint (if available); it does not attempt to resolve the target namespace.

Parameters:

targetNamespace - The target namespace of the required schema components. In the case of xs:include, xs:redefine, and xs:override (where no target namespace is identified), the parameter is set to null. In the case of xs:import, the parameter is set to the value of the namespace attribute if present, or to the zero-length string otherwise.
baseUri - The base URI of the module containing the reference to a schema document declaration
locationHint - The URI (if any) provided as a location hint: typically, the value of the schemaLocation attribute on xs:include or xs:import. Note: the import schema declaration in XQuery permits several location hints; if there is more than one, all but the first are ignored

Returns:

An IResource representing the schema document to be loaded.