Package com.saxonica.ee.schema
Class UserListType
- java.lang.Object
-
- com.saxonica.ee.schema.SchemaStructure
-
- com.saxonica.ee.schema.UserDefinedType
-
- com.saxonica.ee.schema.UserSimpleType
-
- com.saxonica.ee.schema.UserListType
-
- All Implemented Interfaces:
SerializableSchemaComponent
,UserSchemaComponent
,javax.xml.transform.SourceLocator
,Location
,CastingTarget
,ListType
,SchemaComponent
,SchemaType
,SimpleType
,org.xml.sax.Locator
public class UserListType extends UserSimpleType implements ListType
Represents a SimpleType that is a list of a given SimpleType, known as its itemType. A ListType may be a restriction of another ListType; the itemType must either be an AtomicType or a UnionType whose members are not list types.This class is not used to implement the built-in list types NMTOKENS, ENTITIES, IDREFS.
-
-
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 UserListType(EnterpriseConfiguration config)
Create a new user-defined ListType.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.List<Facet>
addInheritedFacets(java.util.List<Facet> localFacets)
Get the extended facet list, creating it if necessary.ValidationFailure
checkAgainstListFacets(java.lang.CharSequence value, NamespaceResolver nsResolver, ConversionRules rules, int count)
Check whether a supplied value is valid against the facets defined on the list type.void
elaborate(SchemaCompiler compiler)
Elaborate the schema component: after reloading a serialized schema component model, this expands the component with derived information needed during validation episodes.SimpleType
getItemType()
Returns the simpleType of the items in this ListType.TypeReference
getItemTypeReference()
Get the reference to the item type of the listAtomicSequence
getTypedValue(java.lang.CharSequence value, NamespaceResolver resolver, ConversionRules rules)
Get the typed value of a given input string.void
inheritSeparator(UserListType base)
boolean
isAtomicType()
Test whether this Simple Type is an atomic typeboolean
isBuiltInType()
Determine whether this is a built-in type or a user-defined typeboolean
isIdRefType()
Ask whether this type is an IDREF or IDREFS type.boolean
isIdType()
Ask whether this type is an ID type.boolean
isListType()
Returns true if this type is derived by list, or if it is derived by restriction from a list type, or if it is a union that contains a list as one of its membersboolean
isNamespaceSensitive()
Test whether this simple type is namespace-sensitive, that is, whether the item types is derived from xs:QName or xs:NOTATIONvoid
serializeVariety(SchemaModelSerializer serializer)
Serialize the schema componentvoid
setItemTypeReference(TypeReference type)
Sets the itemType for this ListType (the type of item that instances of this list type contain).void
setTokenSeparator(RegularExpression regex)
Set the regular expression defined in saxon:separator for tokenizing the supplied valuejava.lang.String
toString()
Produce a string representation of the type name.ValidationFailure
validateContent(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, analyzeContentExpression, applyWhitespaceNormalization, atomize, checkAgainstFacets, checkTypeDerivationIsOK, convertFacetValues, getBuiltInBaseType, getComponentAsFunction, getComponentAsFunction, getContextComponent, getEQName, getExtendedFacetList, getFacet, getLocalFacetList, getWhitespaceAction, isSimpleType, isTypeDerivationOK, isUnionType, makeValidationFailure, mergeEnumerationFacets, postprocess, preprocess, serialize, setContextComponent, setFacetList, validate
-
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
-
Methods inherited from class com.saxonica.ee.schema.SchemaStructure
fixup, 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, analyzeContentExpression, atomize, checkTypeDerivationIsOK, getBaseType, getBlock, getDerivationMethod, getDescription, getDisplayName, getEQName, getFinalProhibitions, getFingerprint, getName, getNearestNamedType, getStructuredQName, getSystemId, getTargetNamespace, isAnonymousType, isComplexType, isSameType, isSimpleType
-
Methods inherited from interface net.sf.saxon.type.SimpleType
getBuiltInBaseType, getWhitespaceAction, isUnionType, postprocess, preprocess
-
Methods inherited from interface com.saxonica.ee.schema.UserSchemaComponent
fixup, lookForCycles
-
-
-
-
Constructor Detail
-
UserListType
public UserListType(EnterpriseConfiguration config)
Create a new user-defined ListType.- Parameters:
config
- the Saxon configuration
-
-
Method Detail
-
isAtomicType
public boolean isAtomicType()
Test whether this Simple Type is an atomic type- Specified by:
isAtomicType
in interfaceSchemaType
- Specified by:
isAtomicType
in interfaceSimpleType
- Overrides:
isAtomicType
in classUserSimpleType
- Returns:
- false, this is not an atomic type
-
isIdType
public boolean isIdType() throws MissingComponentException
Ask whether this type is an ID type. This is defined to be any simple type who typed value may contain atomic values of type xs:ID: that is, it includes types derived from ID by restriction, list, or union. Note that for a node to be treated as an ID in XSD 1.0, its typed value must be a *single* atomic value of type ID; the type of the node, however, can still allow a list. But in XSD 1.1, a list of IDs is permitted- Specified by:
isIdType
in interfaceSchemaType
- Overrides:
isIdType
in classUserSimpleType
- Returns:
- true if this type is an ID type
- Throws:
MissingComponentException
-
isIdRefType
public boolean isIdRefType() throws MissingComponentException
Ask whether this type is an IDREF or IDREFS type. This is defined to be any simple type who typed value may contain atomic values of type xs:IDREF: that is, it includes types derived from IDREF or IDREFS by restriction, list, or union- Specified by:
isIdRefType
in interfaceSchemaType
- Overrides:
isIdRefType
in classUserSimpleType
- Returns:
- true if this type is an IDREF type
- Throws:
MissingComponentException
-
isBuiltInType
public boolean isBuiltInType()
Determine whether this is a built-in type or a user-defined type- Specified by:
isBuiltInType
in interfaceSimpleType
- Returns:
- true if this is a built-in type
-
isListType
public boolean isListType()
Returns true if this type is derived by list, or if it is derived by restriction from a list type, or if it is a union that contains a list as one of its members- Specified by:
isListType
in interfaceSimpleType
- Overrides:
isListType
in classUserSimpleType
- Returns:
- true if this is a list type
-
addInheritedFacets
protected java.util.List<Facet> addInheritedFacets(java.util.List<Facet> localFacets)
Get the extended facet list, creating it if necessary. The extended facet list includes facets inherited from supertypes, unless they are redundant- Overrides:
addInheritedFacets
in classUserSimpleType
- Returns:
- the extended facet list
-
elaborate
public void elaborate(SchemaCompiler compiler) throws SchemaException
Description copied from class:UserSimpleType
Elaborate the schema component: after reloading a serialized schema component model, this expands the component with derived information needed during validation episodes. The model is assumed to be valid.- Specified by:
elaborate
in interfaceUserSchemaComponent
- Overrides:
elaborate
in classUserSimpleType
- Parameters:
compiler
- the schema compiler- Throws:
SchemaException
- if a fatal error occurs
-
getItemTypeReference
public TypeReference getItemTypeReference()
Get the reference to the item type of the list- Returns:
- the type reference
-
getItemType
public SimpleType getItemType() throws MissingComponentException
Returns the simpleType of the items in this ListType. This method assumes that the item type has been fully resolved- Specified by:
getItemType
in interfaceListType
- Returns:
- the simpleType of the items in this ListType. This will either be an AtomicType or a UnionType
- Throws:
MissingComponentException
- if the item type has not been fully resolved
-
setItemTypeReference
public void setItemTypeReference(TypeReference type)
Sets the itemType for this ListType (the type of item that instances of this list type contain). For internal use only.- Parameters:
type
- the SimpleType for this ListType.
-
setTokenSeparator
public void setTokenSeparator(RegularExpression regex)
Set the regular expression defined in saxon:separator for tokenizing the supplied value- Parameters:
regex
- the regular expression
-
inheritSeparator
public void inheritSeparator(UserListType base)
-
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:
validateContent
in 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 used in this configuration- Returns:
- null if validation succeeds; return a ValidationException describing the validation failure if validation fails, unless throwException is true, in which case the exception is thrown rather than being returned.
- Throws:
java.lang.UnsupportedOperationException
- if the type is namespace-sensitive and no namespace resolver is supplied
-
checkAgainstListFacets
public ValidationFailure checkAgainstListFacets(java.lang.CharSequence value, NamespaceResolver nsResolver, ConversionRules rules, int count)
Check whether a supplied value is valid against the facets defined on the list type. This method does NOT check that the items in the list are valid against the item type of the list- Parameters:
value
- the supplied valuensResolver
- the namespace contextrules
- the conversion rulescount
- the number of items in the list- Returns:
- either null if the value is valid, or a ValidationFailure giving diagnostics
-
getTypedValue
public AtomicSequence getTypedValue(java.lang.CharSequence value, NamespaceResolver resolver, ConversionRules rules) throws ValidationException
Get the typed value of a given input string. This method assumes that the input value is valid according to this SimpleType- Specified by:
getTypedValue
in interfaceSimpleType
- Parameters:
value
- the string whose typed value is requiredresolver
- namespace resolverrules
- the conversion rules used in this configuration- Returns:
- the typed value as an iterator
- Throws:
ValidationException
- if the input is invalid against this type
-
isNamespaceSensitive
public boolean isNamespaceSensitive()
Test whether this simple type is namespace-sensitive, that is, whether the item types is derived from xs:QName or xs:NOTATION- Specified by:
isNamespaceSensitive
in interfaceSimpleType
- Returns:
- true if the item type is derived from xs:QName or xs:NOTATION; or if the item type cannot be determined (because it is missing from the schema)
-
serializeVariety
public void serializeVariety(SchemaModelSerializer serializer) throws XPathException
Serialize the schema component- Specified by:
serializeVariety
in classUserSimpleType
- Throws:
XPathException
-
toString
public java.lang.String toString()
Produce a string representation of the type name. If the type is anonymous, an internally-allocated type name will be returned.- Overrides:
toString
in classUserDefinedType
- Returns:
- the name of the atomic type in the form Q{uri}local
-
-