Package com.saxonica.ee.schema
Class TypeAlternative
java.lang.Object
com.saxonica.ee.schema.SchemaStructure
com.saxonica.ee.schema.TypeAlternative
- All Implemented Interfaces:
UserSchemaComponent
,SourceLocator
,Location
,SchemaComponent
,Locator
A TypeAlternative schema component (See XML Schema 1.1 Part 1 Working Draft)
-
Constructor Summary
ConstructorsConstructorDescriptionTypeAlternative
(EnterpriseConfiguration config, XPathExpression condition, String text) Create an TypeAlternative component -
Method Summary
Modifier and TypeMethodDescriptionboolean
fixup
(SchemaCompiler compiler) Fixup references from this schema component to othersGet the base URI of the XPath expressionGet the schema component in the form of a function item.Get the XPath expression used in the test attribute of the alternative.Get the original text of the condition.Get the default namesapce for elements and types from the static context of the XPath expressionGet the namespace context for evaluating the XPath expressionGet the parameters declared for this schema document using the saxon:param extension elementGet the fixed-up schema type for this alternativeGet the type reference for this alternativevoid
serialize
(SchemaModelSerializer serializer) Serialize the schema componentvoid
setBaseURI
(String baseURI) Set the base URI of the XPath expression.void
setDefaultElementNamespace
(NamespaceUri namespace) Set the default namespace for elements and types from the static context of the XPath expressionvoid
setNamespaceContext
(NamespaceResolver resolver) Set the namespace context.void
setParameters
(Map<StructuredQName, XPathVariable> parameters) Set the parameters declared for this schema document using the saxon:param extension elementvoid
Set the type reference for this alternativeMethods inherited from class com.saxonica.ee.schema.SchemaStructure
elaborate, getColumnNumber, getConfiguration, getFixupStatus, getGeneratedId, getLineNumber, getPublicId, getRedefinitionLevel, getSchemaDocumentURI, getSystemId, getValidationStatus, hasSameLocation, isValidationNeeded, lookForCycles, makeXPathExpressionPropertyRecord, saveLocation, setConfiguration, setFixupStatus, setGeneratedId, setLineNumber, setLocator, setRedefinitionLevel, setSchemaDocumentURI, setSystemId, setValidationStatus, validate
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.sf.saxon.type.SchemaComponent
getRedefinitionLevel, getValidationStatus
-
Constructor Details
-
TypeAlternative
Create an TypeAlternative component- Parameters:
config
- the Saxon configurationcondition
- the compiled XPath expression. May be null if no condition was specified (this is allowed on the last alternative)text
- the original text of the XPath expression. May be null if no condition was specified (this is allowed on the last alternative)
-
-
Method Details
-
getCondition
Get the XPath expression used in the test attribute of the alternative. Null represents an absent condition, equivalent to "true()".- Returns:
- the XPath expression
-
getConditionText
Get the original text of the condition.- Returns:
- the original text of the XPath expression. May be null if no condition was specified
-
setDefaultElementNamespace
Set the default namespace for elements and types from the static context of the XPath expression- Parameters:
namespace
- the default namespace for elements and types. The null namespace is represented as ""
-
getDefaultElementNamespace
Get the default namesapce for elements and types from the static context of the XPath expression- Returns:
- the default namespace for elements and types. The null namespace is represented as ""
-
setNamespaceContext
Set the namespace context. This is needed to allow the assertion to be serialized, so that the namespace context can be replicated when it is reloaded.- Parameters:
resolver
- defines the namespace context
-
getNamespaceContext
Get the namespace context for evaluating the XPath expression- Returns:
- a NamespaceResolver representing the namespace context of the expression
-
setBaseURI
Set the base URI of the XPath expression. This is needed to allow the assertion to be serialized.- Parameters:
baseURI
- the static base URI of the expression
-
getBaseURI
Get the base URI of the XPath expression- Returns:
- the static base URI of the expression
-
setTypeReference
Set the type reference for this alternative- Parameters:
type
- a reference to the type selected by this alternative
-
getTypeReference
Get the type reference for this alternative- Returns:
- the type reference
-
setParameters
Set the parameters declared for this schema document using the saxon:param extension element- Parameters:
parameters
- the declared saxon:param parameters in scope for the XPath expression
-
getParameters
Get the parameters declared for this schema document using the saxon:param extension element- Returns:
- the declared saxon:param parameters in scope for the XPath expression
-
getSchemaType
Get the fixed-up schema type for this alternative- Returns:
- the schema type
- Throws:
MissingComponentException
-
fixup
Fixup references from this schema component to others- Specified by:
fixup
in interfaceUserSchemaComponent
- Overrides:
fixup
in classSchemaStructure
- Parameters:
compiler
- the SchemaCompiler, used primarily for reporting errors- Returns:
- true if all references were fixed up successfully, false if dangling references were found
- Throws:
SchemaException
-
serialize
Serialize the schema component- Parameters:
serializer
- the object responsible for serialization- Throws:
XPathException
- if a serialization error occur
-
getComponentAsFunction
Description copied from interface:SchemaComponent
Get the schema component in the form of a function item. This allows schema information to be made visible to XSLT or XQuery code. The function makes available the contents of the schema component as defined in the XSD specification. The function takes a string as argument representing a property name, and returns the corresponding property of the schema component. There is also a property "class" which returns the kind of schema component, for example "Attribute Declaration".- Specified by:
getComponentAsFunction
in interfaceSchemaComponent
- Overrides:
getComponentAsFunction
in classSchemaStructure
- Returns:
- the schema component represented as a function from property names to property values.
-