public abstract class UserSimpleType extends UserDefinedType implements SimpleType, UserSchemaComponent, SerializableSchemaComponent
extendedTypes, finalProhibitionsDERIVATION_EXTENSION, DERIVATION_LIST, DERIVATION_RESTRICTION, DERIVATION_UNION, DERIVE_BY_SUBSTITUTIONCOMPONENT_FUNCTION_TYPE, FIXED_UP, INCOMPLETE, INVALID, UNVALIDATED, VALIDATED, VALIDATING| Constructor and Description |
|---|
UserSimpleType()
Construct a UserSimpleType
|
| Modifier and Type | Method and Description |
|---|---|
void |
addFacet(Facet facet)
Add the given Facet to this Simpletype.
|
protected List<Facet> |
addInheritedFacets(List<Facet> localFacets) |
void |
analyzeContentExpression(Expression expression,
int kind,
StaticContext env)
Analyze an expression to see whether the expression is capable of delivering a value of this
type.
|
CharSequence |
applyWhitespaceNormalization(CharSequence value)
Apply the whitespace normalization rules for this simple type
|
AtomicSequence |
atomize(NodeInfo node)
Get the typed value of a node that is annotated with this schema type.
|
ValidationFailure |
checkAgainstFacets(AtomicSequence primitiveValue,
CharSequence lexicalValue,
List<Facet> facets,
ConversionRules rules)
Validate that the value conforms to all the constraining facets for the given type.
|
void |
checkTypeDerivationIsOK(SchemaType type,
int block)
Check that this type is validly derived from a given type
|
void |
convertFacetValues()
Convert the values of facets to the target data 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.
|
SchemaType |
getBuiltInBaseType()
Returns the built-in base type this type is derived from.
|
FunctionItem |
getComponentAsFunction()
Get the schema component in the form of a function item.
|
static FunctionItem |
getComponentAsFunction(SimpleType type)
Get schema information for a simple type in the form of a function item
|
SchemaComponent |
getContextComponent()
Get the component that contains the definition of this anonymous simple type definition
|
String |
getEQName()
Get the name of this type as an EQName, that is, a string in the format Q{uri}local.
|
List<Facet> |
getExtendedFacetList()
Get the extended facet list, creating it if necessary.
|
Facet |
getFacet(Class name)
Returns the first facet associated with the given name, defined either on this type
or on a type from which it is derived
|
List<Facet> |
getLocalFacetList()
Return all the facets for this type
|
int |
getWhitespaceAction()
Determine the whitespace normalization required for values of this type
|
boolean |
isAtomicType()
Test whether this Simple Type is an atomic type
|
boolean |
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 members
|
boolean |
isSimpleType()
Returns true if this SchemaType is a SimpleType
|
static String |
isTypeDerivationOK(SimpleType d,
SchemaType b,
int derivation)
Check whether type derivation is allowed.
|
boolean |
isUnionType()
Return true if this type is a union type (that is, if its variety is union),
which will be true if is derived by union, or if it is derived by restriction from
a type whose variety is union.
|
void |
mergeEnumerationFacets(SchemaCompiler compiler)
Merge enumeration facets into a single enumerationSet pseudo-facet.
|
CharSequence |
postprocess(CharSequence input)
Reverse any pre-lexical facets, other than whitespace.
|
CharSequence |
preprocess(CharSequence input)
Apply any pre-lexical facets, other than whitespace.
|
void |
serialize(SchemaModelSerializer serializer)
Serialize the schema component
|
protected abstract void |
serializeVariety(SchemaModelSerializer serializer) |
void |
setContextComponent(SchemaComponent contextComponent)
Set the component that contains the definition of this anonymous simple type definition
|
void |
setFacetList(List<Facet> facetList)
Set the local facet list for this simple type
|
boolean |
validate(SchemaCompiler compiler)
Checks the validity of this SimpleType definition.
|
allowsDerivation, containingDeclarationIsElement, getBaseType, getBaseTypeFingerprint, getBaseTypeReference, getBlock, getContainingDeclarationName, getDerivationMethod, getDescription, getDisplayName, getExtensionTypes, getFinalProhibitions, getFingerprint, getLocalName, getName, getNameCode, getNamePool, getTargetNamespace, isAnonymousType, isComplexType, isExternalType, isSameType, registerExtensionType, setBaseTypeReference, setContainingDeclaration, setDerivationMethod, setDerivationMethodName, setExtendedTypes, setFinalProhibitions, setNameCodefixup, getColumnNumber, getConfiguration, getFixupStatus, getLineNumber, getPublicId, getRedefinitionLevel, getSchemaDocumentURI, getSystemId, getValidationStatus, lookForCycles, makeXPathExpressionPropertyRecord, setConfiguration, setFixupStatus, setLineNumber, setLocator, setRedefinitionLevel, setSchemaDocumentURI, setSystemId, setValidationStatusclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetTypedValue, isBuiltInType, isExternalType, isNamespaceSensitive, validateContentallowsDerivation, getBaseType, getBlock, getDerivationMethod, getDescription, getDisplayName, getFinalProhibitions, getFingerprint, getName, getNameCode, getSystemId, getTargetNamespace, isAnonymousType, isComplexType, isSameTypegetRedefinitionLevel, getValidationStatusfixup, lookForCyclespublic final boolean isSimpleType()
isSimpleType in interface SchemaTypepublic boolean isAtomicType()
isAtomicType in interface SchemaTypeisAtomicType in interface SimpleTypepublic boolean isIdType()
isIdType in interface SchemaTypepublic boolean isIdRefType()
isIdRefType in interface SchemaTypepublic boolean isListType()
isListType in interface SimpleTypepublic boolean isUnionType()
isUnionType in interface SimpleTypepublic SchemaComponent getContextComponent()
public void setContextComponent(SchemaComponent contextComponent)
contextComponent - the containing component, or null of the type is not anonymouspublic List<Facet> getExtendedFacetList()
public String getEQName()
getEQName in interface SchemaTypepublic void addFacet(Facet facet)
facet - the Facet to add to this Simpletypepublic void mergeEnumerationFacets(SchemaCompiler compiler) throws SchemaException, UnresolvedReferenceException
compiler - used for error reportingSchemaException - if a schema validity error is foundUnresolvedReferenceException - if an unresolved reference to a schema component is foundpublic Facet getFacet(Class name)
name - the required class of facetpublic void setFacetList(List<Facet> facetList)
facetList - the list of facetspublic void convertFacetValues()
throws SchemaException
SchemaException - if conversion failspublic int getWhitespaceAction()
getWhitespaceAction in interface SimpleTypeIllegalStateException - if the simple type is not fully validated and the
whitespace facet is not yet known.public CharSequence applyWhitespaceNormalization(CharSequence value)
value - the string before whitespace normalizationpublic SchemaType getBuiltInBaseType()
getBuiltInBaseType in interface SimpleTypepublic void checkTypeDerivationIsOK(SchemaType type, int block) throws SchemaException
checkTypeDerivationIsOK in interface SchemaTypecheckTypeDerivationIsOK in class UserDefinedTypetype - the type from which this type is derivedblock - the derivations that are blocked by the relevant element declarationSchemaException - if the derivation is not allowedpublic boolean validate(SchemaCompiler compiler) throws SchemaException, UnresolvedReferenceException
validate in interface UserSchemaComponentcompiler - used for error reportingSchemaException - if this SimpleType definition is invalid.UnresolvedReferenceExceptionpublic void analyzeContentExpression(Expression expression, int kind, StaticContext env) throws XPathException
analyzeContentExpression in interface SchemaTypeexpression - the expression that delivers the contentkind - the node kind whose content is being delivered: Type.ELEMENT,
Type.ATTRIBUTE, or Type.DOCUMENTenv - the static contextXPathException - if the expression will never deliver a value of the correct typepublic AtomicSequence atomize(NodeInfo node) throws XPathException
atomize in interface SchemaTypenode - the node whose typed value is requiredXPathException - if the node cannot be atomized, for example if this is a complex type
with element-only contentpublic static String isTypeDerivationOK(SimpleType d, SchemaType b, int derivation)
d - the derived typeb - the base typederivation - the disallowed derivations, as a bit-significant integerpublic List<Facet> getLocalFacetList()
public CharSequence preprocess(CharSequence input) throws ValidationException
preprocess in interface SimpleTypeinput - the value to be preprocessedValidationException - if preprocessing detects that the value is invalidpublic CharSequence postprocess(CharSequence input) throws ValidationException
postprocess in interface SimpleTypeinput - the value to be postprocessed: this is the "ordinary" result of converting
the value to a stringValidationException - if postprocessing detects that the value is invalidpublic ValidationFailure checkAgainstFacets(AtomicSequence primitiveValue, CharSequence lexicalValue, List<Facet> facets, ConversionRules rules)
primitiveValue - the typed value to be checked, as an instance of its primitive typelexicalValue - The supplied value; this must be normalized using the whitespace
facet, and then checked against the pattern facet.
May be null; if so the actual value is converted to a string for checking
against the pattern.facets - List of the facets to be checked: can be obtained using one of the various
getFacets() methods.rules - Validation context (including values of parameters declared using saxon:param)public void elaborate(SchemaCompiler compiler) throws SchemaException
elaborate in interface UserSchemaComponentelaborate in class SchemaStructurecompiler - the schema compilerSchemaException - if a fatal error occurspublic void serialize(SchemaModelSerializer serializer) throws XPathException
serialize in interface SerializableSchemaComponentserializer - the object responsible for performing the serializationXPathException - if serialization failsprotected abstract void serializeVariety(SchemaModelSerializer serializer) throws XPathException
XPathExceptionpublic FunctionItem getComponentAsFunction()
SchemaComponentgetComponentAsFunction in interface SchemaComponentpublic static FunctionItem getComponentAsFunction(SimpleType type)
type - The type whose component information is requiredCopyright (c) 2004-2013 Saxonica Limited. All rights reserved.