public abstract class UserSimpleType extends UserDefinedType implements SimpleType, UserSchemaComponent, SerializableSchemaComponent
SchemaComponent.ValidationStatusextendedTypes, finalProhibitionsDERIVATION_EXTENSION, DERIVATION_LIST, DERIVATION_RESTRICTION, DERIVATION_UNION, DERIVE_BY_SUBSTITUTIONCOMPONENT_FUNCTION_TYPE| 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 java.util.List<Facet> |
addInheritedFacets(java.util.List<Facet> localFacets) |
void |
analyzeContentExpression(Expression expression,
int kind)
Analyze an expression to see whether the expression is capable of delivering a value of this
type.
|
java.lang.CharSequence |
applyWhitespaceNormalization(java.lang.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,
java.lang.CharSequence lexicalValue,
java.util.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.
|
java.lang.String |
generateJavaScriptItemTypeAcceptor(java.lang.String errorCode,
int targetVersion)
Generate Javascript code to convert a supplied Javascript value to this item type,
if conversion is possible, or throw an error otherwise.
|
java.lang.String |
generateJavaScriptItemTypeTest(ItemType knownToBe,
int targetVersion)
Generate Javascript code to test whether an item conforms to this item type
|
SchemaType |
getBuiltInBaseType()
Returns the built-in base type this type is derived from.
|
Function |
getComponentAsFunction()
Get the schema component in the form of a function item.
|
static Function |
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
|
java.lang.String |
getEQName()
Get the name of this type as an EQName, that is, a string in the format Q{uri}local.
|
java.util.List<Facet> |
getExtendedFacetList()
Get the extended facet list, creating it if necessary.
|
Facet |
getFacet(java.lang.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
|
java.util.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 java.lang.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.
|
static ValidationFailure |
makeValidationFailure(AtomicSequence primitiveValue,
SimpleType type,
Facet f) |
void |
mergeEnumerationFacets(SchemaCompiler compiler)
Merge enumeration facets into a single enumerationSet pseudo-facet.
|
java.lang.CharSequence |
postprocess(java.lang.CharSequence input)
Reverse any pre-lexical facets, other than whitespace.
|
java.lang.CharSequence |
preprocess(java.lang.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(java.util.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, getName, getNamePool, getStructuredQName, getTargetNamespace, isAnonymousType, isComplexType, isExternalType, isSameType, isSameURI, registerExtensionType, setBaseTypeReference, setContainingDeclaration, setDerivationMethod, setDerivationMethodName, setExtendedTypes, setFinalProhibitions, setTypeName, toStringfixup, getColumnNumber, getConfiguration, getFixupStatus, getGeneratedId, getLineNumber, getPublicId, getRedefinitionLevel, getSchemaDocumentURI, getSystemId, getValidationStatus, hasSameLocation, isValidationNeeded, lookForCycles, makeXPathExpressionPropertyRecord, saveLocation, setConfiguration, setFixupStatus, setGeneratedId, setLineNumber, setLocator, setRedefinitionLevel, setSchemaDocumentURI, setSystemId, setValidationStatusclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetTypedValue, isBuiltInType, isExternalType, isNamespaceSensitive, validateContentallowsDerivation, getBaseType, getBlock, getDerivationMethod, getDescription, getDisplayName, getFinalProhibitions, getFingerprint, getName, getNearestNamedType, getStructuredQName, 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()
throws MissingComponentException
isIdType in interface SchemaTypeMissingComponentExceptionpublic boolean isIdRefType()
throws MissingComponentException
isIdRefType in interface SchemaTypeMissingComponentExceptionpublic 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 java.util.List<Facet> getExtendedFacetList()
protected java.util.List<Facet> addInheritedFacets(java.util.List<Facet> localFacets)
public java.lang.String getEQName()
getEQName in interface SchemaTypegetEQName in class UserDefinedTypepublic void addFacet(Facet facet)
facet - the Facet to add to this Simpletypepublic void mergeEnumerationFacets(SchemaCompiler compiler) throws SchemaException, MissingComponentException
compiler - used for error reportingSchemaException - if a schema validity error is foundMissingComponentException - if an unresolved reference to a schema component is foundpublic Facet getFacet(java.lang.Class name)
name - the required class of facetpublic void setFacetList(java.util.List<Facet> facetList)
facetList - the list of facetspublic void convertFacetValues()
throws SchemaException
SchemaException - if conversion failspublic int getWhitespaceAction()
getWhitespaceAction in interface SimpleTypejava.lang.IllegalStateException - if the simple type is not fully validated and the
whitespace facet is not yet known.public java.lang.CharSequence applyWhitespaceNormalization(java.lang.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
validate in interface UserSchemaComponentcompiler - used for error reportingSchemaException - if this SimpleType definition is invalid.public void analyzeContentExpression(Expression expression, int kind) 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.DOCUMENTXPathException - 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 java.lang.String isTypeDerivationOK(SimpleType d, SchemaType b, int derivation) throws MissingComponentException
d - the derived typeb - the base typederivation - the disallowed derivations, as a bit-significant integerMissingComponentExceptionpublic java.util.List<Facet> getLocalFacetList()
public java.lang.CharSequence preprocess(java.lang.CharSequence input)
throws ValidationException
preprocess in interface SimpleTypeinput - the value to be preprocessedValidationException - if preprocessing detects that the value is invalidpublic java.lang.CharSequence postprocess(java.lang.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, java.lang.CharSequence lexicalValue, java.util.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 static ValidationFailure makeValidationFailure(AtomicSequence primitiveValue, SimpleType type, Facet f)
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 serializationMissingComponentException - if the component cannot be serialized because it contains dangling referencesXPathException - if serialization failsprotected abstract void serializeVariety(SchemaModelSerializer serializer) throws XPathException
XPathExceptionpublic Function getComponentAsFunction()
SchemaComponentgetComponentAsFunction in interface SchemaComponentpublic static Function getComponentAsFunction(SimpleType type)
type - The type whose component information is requiredpublic java.lang.String generateJavaScriptItemTypeTest(ItemType knownToBe, int targetVersion) throws XPathException
knownToBe - An item type that the supplied item is known to conform to; the generated code
can assume that the item is an instance of this type.targetVersion - The version of Saxon-JS for which code is being generated. Currently either 1 or 2.XPathException - if JS code cannot be generated for this item type, for example because
the test is schema-aware.public java.lang.String generateJavaScriptItemTypeAcceptor(java.lang.String errorCode,
int targetVersion)
throws XPathException
errorCode - the error to be thrown if conversion is not possibletargetVersion - the version of Saxon-JS for which code is to be generatedXPathExceptionCopyright (c) 2004-2020 Saxonica Limited. All rights reserved.