public abstract class UserSimpleType extends UserDefinedType implements SimpleType, UserSchemaComponent, SerializableSchemaComponent
extendedTypes, finalProhibitions
DERIVATION_EXTENSION, DERIVATION_LIST, DERIVATION_RESTRICTION, DERIVATION_UNION, DERIVE_BY_SUBSTITUTION
COMPONENT_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, setNameCode, toString
fixup, getColumnNumber, getConfiguration, getFixupStatus, getLineNumber, getPublicId, getRedefinitionLevel, getSchemaDocumentURI, getSystemId, getValidationStatus, lookForCycles, makeXPathExpressionPropertyRecord, setConfiguration, setFixupStatus, setLineNumber, setLocator, setRedefinitionLevel, setSchemaDocumentURI, setSystemId, setValidationStatus
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getTypedValue, isBuiltInType, isExternalType, isNamespaceSensitive, validateContent
allowsDerivation, getBaseType, getBlock, getDerivationMethod, getDescription, getDisplayName, getFinalProhibitions, getFingerprint, getName, getNameCode, getSystemId, getTargetNamespace, isAnonymousType, isComplexType, isSameType
getRedefinitionLevel, getValidationStatus
fixup, lookForCycles
public final boolean isSimpleType()
isSimpleType
in interface SchemaType
public boolean isAtomicType()
isAtomicType
in interface SchemaType
isAtomicType
in interface SimpleType
public boolean isIdType()
isIdType
in interface SchemaType
public boolean isIdRefType()
isIdRefType
in interface SchemaType
public boolean isListType()
isListType
in interface SimpleType
public boolean isUnionType()
isUnionType
in interface SimpleType
public 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 SchemaType
public 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 SimpleType
IllegalStateException
- 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 SimpleType
public void checkTypeDerivationIsOK(SchemaType type, int block) throws SchemaException
checkTypeDerivationIsOK
in interface SchemaType
checkTypeDerivationIsOK
in class UserDefinedType
type
- 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 UserSchemaComponent
compiler
- used for error reportingSchemaException
- if this SimpleType definition is invalid.UnresolvedReferenceException
public void analyzeContentExpression(Expression expression, int kind, StaticContext env) throws XPathException
analyzeContentExpression
in interface SchemaType
expression
- the expression that delivers the contentkind
- the node kind whose content is being delivered: Type.ELEMENT
,
Type.ATTRIBUTE
, or Type.DOCUMENT
env
- the static contextXPathException
- if the expression will never deliver a value of the correct typepublic AtomicSequence atomize(NodeInfo node) throws XPathException
atomize
in interface SchemaType
node
- 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 SimpleType
input
- the value to be preprocessedValidationException
- if preprocessing detects that the value is invalidpublic CharSequence postprocess(CharSequence input) throws ValidationException
postprocess
in interface SimpleType
input
- 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 UserSchemaComponent
elaborate
in class SchemaStructure
compiler
- the schema compilerSchemaException
- if a fatal error occurspublic void serialize(SchemaModelSerializer serializer) throws XPathException
serialize
in interface SerializableSchemaComponent
serializer
- the object responsible for performing the serializationXPathException
- if serialization failsprotected abstract void serializeVariety(SchemaModelSerializer serializer) throws XPathException
XPathException
public FunctionItem getComponentAsFunction()
SchemaComponent
getComponentAsFunction
in interface SchemaComponent
public static FunctionItem getComponentAsFunction(SimpleType type)
type
- The type whose component information is requiredCopyright (c) 2004-2014 Saxonica Limited. All rights reserved.