Package com.saxonica.ee.schema.sdoc
Class SimpleTypeDefinition
- java.lang.Object
-
- com.saxonica.ee.schema.SchemaStructure
-
- com.saxonica.ee.schema.UserDefinedType
-
- com.saxonica.ee.schema.UserSimpleType
-
- com.saxonica.ee.schema.sdoc.SimpleTypeDefinition
-
- All Implemented Interfaces:
SerializableSchemaComponent,UserSchemaComponent,javax.xml.transform.SourceLocator,Location,SchemaComponent,SchemaType,SimpleType,org.xml.sax.Locator
public class SimpleTypeDefinition extends UserSimpleType implements UserSchemaComponent
A simple type definition holds all the information about a simpleType during the course of schema processing. On completion of schema processing, a more specific SimpleType object is created, called the WorkingType: this will be for example aUserListType,UserAtomicType, orUserUnionType, and the SimpleTypeDefinition is then discarded.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.sf.saxon.type.SchemaComponent
SchemaComponent.ValidationStatus
-
-
Field Summary
-
Fields inherited from class com.saxonica.ee.schema.UserDefinedType
extendedTypes, finalProhibitions
-
Fields inherited from interface net.sf.saxon.type.SchemaComponent
COMPONENT_FUNCTION_TYPE
-
Fields inherited from interface net.sf.saxon.type.SchemaType
DERIVATION_EXTENSION, DERIVATION_LIST, DERIVATION_RESTRICTION, DERIVATION_UNION, DERIVE_BY_SUBSTITUTION
-
-
Constructor Summary
Constructors Constructor Description SimpleTypeDefinition(EnterpriseConfiguration config)Create a SimpleTypeDefinition
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMemberType(TypeReference memberType)Add a member type to this union typebooleanfixup(SchemaCompiler compiler)Check references from this component to other componentsAtomicSequencegetTypedValue(java.lang.CharSequence value, NamespaceResolver resolver, ConversionRules rules)Get the typed value corresponding to a given string value, assuming it is valid against this typeUserSimpleTypegetWorkingType()Get the simple type created for this definitionbooleanisAtomicType()Test whether this Simple Type is an atomic type.booleanisBuiltInType()Determine whether this is a built-in type or a user-defined typebooleanisListType()On a SimpleTypeDefinition, isListType() always returns true if the type is "derived by List".booleanisNamespaceSensitive()Test whether this type is namespace sensitive, that is, if a namespace context is needed to translate between the lexical space and the value space.booleanisUnionType()On a SimpleTypeDefinition, isUnionType() always returns true if the type is "derived by Union".voidserialize(SchemaModelSerializer serializer)Serialize the schema componentprotected voidserializeVariety(SchemaModelSerializer serializer)voidsetIsSimpleContent(boolean b)Indicate that this simple type represents the content type of a complex type with simple contentvoidsetItemTypeReference(TypeReference itemType)Set the reference to an item type of this list typevoidsetTokenSeparator(RegularExpression separator)booleanvalidate(SchemaCompiler compiler)Checks the validity of this SimpleType definition.ValidationFailurevalidateContent(java.lang.CharSequence value, NamespaceResolver nsResolver, ConversionRules rules)Check whether a given input string is valid according to this SimpleType-
Methods inherited from class com.saxonica.ee.schema.UserSimpleType
addFacet, addInheritedFacets, analyzeContentExpression, applyWhitespaceNormalization, atomize, checkAgainstFacets, checkTypeDerivationIsOK, convertFacetValues, elaborate, getBuiltInBaseType, getComponentAsFunction, getComponentAsFunction, getContextComponent, getEQName, getExtendedFacetList, getFacet, getLocalFacetList, getWhitespaceAction, isIdRefType, isIdType, isSimpleType, isTypeDerivationOK, makeValidationFailure, mergeEnumerationFacets, postprocess, preprocess, setContextComponent, setFacetList
-
Methods inherited from class com.saxonica.ee.schema.UserDefinedType
allowsDerivation, containingDeclarationIsElement, getBaseType, getBaseTypeFingerprint, getBaseTypeReference, getBlock, getContainingDeclarationName, getDerivationMethod, getDescription, getDisplayName, getExtensionTypes, getFinalProhibitions, getFingerprint, getName, getNamePool, getStructuredQName, getTargetNamespace, getTypeName, isAnonymousType, isComplexType, isSameType, isSameURI, registerExtensionType, setBaseTypeReference, setContainingDeclaration, setDerivationMethod, setDerivationMethodName, setExtendedTypes, setFinalProhibitions, setTypeName, toString
-
Methods inherited from class com.saxonica.ee.schema.SchemaStructure
getColumnNumber, getConfiguration, getFixupStatus, getGeneratedId, getLineNumber, getPublicId, getRedefinitionLevel, getSchemaDocumentURI, getSystemId, getValidationStatus, hasSameLocation, isValidationNeeded, lookForCycles, makeXPathExpressionPropertyRecord, saveLocation, setConfiguration, setFixupStatus, setGeneratedId, setLineNumber, setLocator, setRedefinitionLevel, setSchemaDocumentURI, setSystemId, setValidationStatus
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.sf.saxon.type.SchemaComponent
getComponentAsFunction, getRedefinitionLevel, getValidationStatus
-
Methods inherited from interface net.sf.saxon.type.SchemaType
allowsDerivation, getBaseType, getBlock, getDerivationMethod, getDescription, getDisplayName, getFinalProhibitions, getFingerprint, getName, getNearestNamedType, getStructuredQName, getSystemId, getTargetNamespace, isAnonymousType, isComplexType, isSameType
-
Methods inherited from interface com.saxonica.ee.schema.UserSchemaComponent
elaborate, lookForCycles
-
-
-
-
Constructor Detail
-
SimpleTypeDefinition
public SimpleTypeDefinition(EnterpriseConfiguration config)
Create a SimpleTypeDefinition- Parameters:
config- the Saxon configuration
-
-
Method Detail
-
setItemTypeReference
public void setItemTypeReference(TypeReference itemType)
Set the reference to an item type of this list type- Parameters:
itemType- reference to a type forming the item type of this list type
-
isAtomicType
public boolean isAtomicType()
Test whether this Simple Type is an atomic type. On a SimpleTypeDefinition, the variety of the type cannot be reliably determined until fixup() has been called to determine the base type.- Specified by:
isAtomicTypein interfaceSchemaType- Specified by:
isAtomicTypein interfaceSimpleType- Overrides:
isAtomicTypein classUserSimpleType- Returns:
- true if this type is known to be atomic
-
isListType
public boolean isListType()
On a SimpleTypeDefinition, isListType() always returns true if the type is "derived by List". A list type that is derived by restricting another List type cannot be reliably recognized until fixup() has been called to determine the base type.- Specified by:
isListTypein interfaceSimpleType- Overrides:
isListTypein classUserSimpleType- Returns:
- true if this type is "derived by List"
-
isUnionType
public boolean isUnionType()
On a SimpleTypeDefinition, isUnionType() always returns true if the type is "derived by Union". A union type that is derived by restricting another Union type cannot be reliably recognized until the fixup() method has been called to determine the base type.- Specified by:
isUnionTypein interfaceSimpleType- Overrides:
isUnionTypein classUserSimpleType- Returns:
- true if this type is "derived by Union"
-
setIsSimpleContent
public void setIsSimpleContent(boolean b)
Indicate that this simple type represents the content type of a complex type with simple content- Parameters:
b- true if this is the content type of a complex type with simple content
-
addMemberType
public void addMemberType(TypeReference memberType)
Add a member type to this union type- Parameters:
memberType- the member type to be added
-
setTokenSeparator
public void setTokenSeparator(RegularExpression separator)
-
getWorkingType
public UserSimpleType getWorkingType()
Get the simple type created for this definition- Returns:
- the UserSimpleType object if it has been created, otherwise null
-
fixup
public boolean fixup(SchemaCompiler compiler) throws SchemaException
Check references from this component to other components- Specified by:
fixupin interfaceUserSchemaComponent- Overrides:
fixupin classSchemaStructure- Parameters:
compiler- used for error reporting- Returns:
- true if all is well, false if errors found
- Throws:
SchemaException
-
validate
public boolean validate(SchemaCompiler compiler) throws SchemaException
Checks the validity of this SimpleType definition.- Specified by:
validatein interfaceUserSchemaComponent- Overrides:
validatein classUserSimpleType- Parameters:
compiler- used for error reporting- Returns:
- true when this Schema definition is valid, otherwise false.
- Throws:
SchemaException- when this SimpleType definition is invalid.
-
getTypedValue
public AtomicSequence getTypedValue(java.lang.CharSequence value, NamespaceResolver resolver, ConversionRules rules) throws ValidationException
Get the typed value corresponding to a given string value, assuming it is valid against this type- Specified by:
getTypedValuein interfaceSimpleType- Parameters:
value- the string valueresolver- a namespace resolver used to resolve prefixes in QNames and notationsrules- the conversion rules for the Configuration- Returns:
- an iterator over the atomic sequence comprising the typed value
- Throws:
ValidationException- if the supplied value is invalid against this simple type
-
isBuiltInType
public boolean isBuiltInType()
Determine whether this is a built-in type or a user-defined type- Specified by:
isBuiltInTypein interfaceSimpleType- Returns:
- true if this is a built-in type
-
isNamespaceSensitive
public boolean isNamespaceSensitive()
Test whether this type is namespace sensitive, that is, if a namespace context is needed to translate between the lexical space and the value space. This is true for types derived from, or containing, QNames and NOTATIONs- Specified by:
isNamespaceSensitivein interfaceSimpleType- Returns:
- true if the type is namespace-sensitive
-
validateContent
public ValidationFailure validateContent(java.lang.CharSequence value, NamespaceResolver nsResolver, ConversionRules rules)
Check whether a given input string is valid according to this SimpleType- Specified by:
validateContentin interfaceSimpleType- Parameters:
value- the input string to be checkednsResolver- a namespace resolver used to resolve namespace prefixes if the type is namespace sensitive. The value supplied may be null; in this case any namespace-sensitive content will throw an UnsupportedOperationException.rules- the conversion rules for the configuration- Returns:
- null if validation succeeds; or return a ValidationFailure describing the validation failure if validation fails. Note that the exception is returned rather than being thrown.
- Throws:
java.lang.UnsupportedOperationException- if the type is namespace-sensitive and no namespace resolver is supplied
-
serialize
public void serialize(SchemaModelSerializer serializer) throws XPathException
Serialize the schema component- Specified by:
serializein interfaceSerializableSchemaComponent- Overrides:
serializein classUserSimpleType- Parameters:
serializer- the object responsible for performing the serialization- Throws:
XPathException- if serialization fails
-
serializeVariety
protected void serializeVariety(SchemaModelSerializer serializer)
- Specified by:
serializeVarietyin classUserSimpleType
-
-