SchemaLocationToSchemaExperienceResolver

How to get SchemaLocationToSchemaExperienceResolver

ES2015+:

import SchemaLocationToSchemaExperienceResolver from 'fontoxml-schema-experience-resolver/SchemaLocationToSchemaExperienceResolver'

ES5:

define([
	'fontoxml-schema-experience-resolver/SchemaLocationToSchemaExperienceResolver'
], function (
	SchemaLocationToSchemaExperienceResolver
) {
});

Type: Class

A schema experience resolver that determines an appropriate schema experience for each document based on the schema location, as specified in the document's XML.

The schema location may be defined in a number of ways:

  • The xsi:noNamespaceSchemaLocation attribute, if no namespace is used for the root element

  • The xsi:schemaLocation attribute, if the root element has a non-null namespaceURI

  • the publicId or systemId properties of the document's doctype

The schema experience to use is then determined to check each of these values (where appropriate) against the locations defined for schema experiences registered to this resolver. Use the SchemaLocationToSchemaExperienceResolver#register method to add a schema experience and its locations.

If no schema experience applies based on these rules, a default may be specified using the SchemaLocationToSchemaExperienceResolver#setDefaultSchemaExperience method.

The schema experience to be passed to either of these methods may be obtained using SxManager#defineSchemaExperience.

Methods

Name Description
register

Registers the given schema experience to be used for the given schema locations.

The schemaExperience argument should be the return value of a call to SxManager#defineSchemaExperience.


  Arguments
# Name Type Description
1. schemaExperience SchemaExperience | Function
2. schemaLocations Array<String>
  Returns

Type: SchemaLocationToSchemaExperienceResolver

The resolver for chaining.

setDefaultSchemaExperience

Set the default schema experience to use when no registered schema matches the document.

The schemaExperience argument should be the return value of a call to SxManager#defineSchemaExperience.


  Arguments
# Name Type Description
1. schemaExperience SchemaExperience | Function
  Returns

Type: SchemaLocationToSchemaExperienceResolver

The resolver for chaining.

Related links