|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.saxonica.schema.SchemaStructure com.saxonica.schema.UserDefinedType com.saxonica.schema.UserSimpleType
public abstract class UserSimpleType
This class represents a used-defined simple type, as defined in the XML Schema specification. This may be an atomic type, a list type, or a union type. In the non-schema-aware version of Saxon, a simple type will always be a built-in type. With the schema-aware product, it may also be a user-defined simple type.
Field Summary |
---|
Fields inherited from class com.saxonica.schema.UserDefinedType |
---|
extendedTypes, finalProhibitions |
Fields inherited from interface net.sf.saxon.type.SimpleType |
---|
VARIETY_ATOMIC, VARIETY_LIST, VARIETY_UNION, VARIETY_UNSPECIFIED_SIMPLE |
Fields inherited from interface net.sf.saxon.type.SchemaType |
---|
DERIVATION_EXTENSION, DERIVATION_LIST, DERIVATION_RESTRICTION, DERIVATION_UNION, DERIVE_BY_SUBSTITUTION |
Fields inherited from interface net.sf.saxon.type.SchemaComponent |
---|
FIXED_UP, INCOMPLETE, INVALID, UNVALIDATED, VALIDATED, VALIDATING |
Constructor Summary | |
---|---|
UserSimpleType()
Construct a UserSimpleType |
Method Summary | |
---|---|
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 |
Value |
atomize(NodeInfo node)
Get the typed value of a node that is annotated with this schema type. |
ValidationFailure |
checkAgainstFacets(Value primitiveValue,
CharSequence lexicalValue,
Iterator iter)
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. |
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 |
Iterator<Facet> |
getFacets()
Returns an Iterator over all the Facets (including inherited facets) for this type. |
List |
getLocalFacetList()
Return all the facets for this type |
SequenceIterator |
getTypedValue(NodeInfo node)
Get the typed value of a node that is annotated with this schema 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 |
setFacetList(List facetList)
Set the local facet list for this simple type |
boolean |
validate(SchemaCompiler compiler)
Checks the validity of this SimpleType definition. |
Methods inherited from class com.saxonica.schema.SchemaStructure |
---|
fixup, getColumnNumber, getConfiguration, getFixupStatus, getLineNumber, getPublicId, getRedefinitionLevel, getSchemaDocumentURI, getSystemId, getValidationStatus, lookForCycles, setConfiguration, setFixupStatus, setLineNumber, setLocator, setRedefinitionLevel, setSchemaDocumentURI, setSystemId, setValidationStatus |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.sf.saxon.type.SimpleType |
---|
getCommonAtomicType, getTypedValue, isBuiltInType, isExternalType, isNamespaceSensitive, validateContent |
Methods inherited from interface net.sf.saxon.type.SchemaType |
---|
allowsDerivation, getBaseType, getBlock, getDerivationMethod, getDescription, getDisplayName, getFingerprint, getName, getNameCode, getSystemId, getTargetNamespace, isAnonymousType, isComplexType, isSameType |
Methods inherited from interface net.sf.saxon.type.SchemaComponent |
---|
getRedefinitionLevel, getValidationStatus |
Methods inherited from interface com.saxonica.schema.UserSchemaComponent |
---|
fixup, lookForCycles |
Constructor Detail |
---|
public UserSimpleType()
Method Detail |
---|
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 List<Facet> getExtendedFacetList()
protected List<Facet> addInheritedFacets(List<Facet> localFacets)
public void addFacet(Facet facet)
facet
- the Facet to add to this Simpletypepublic void mergeEnumerationFacets(SchemaCompiler compiler) throws SchemaException, UnresolvedReferenceException
compiler
- used for error reporting
SchemaException
UnresolvedReferenceException
public Facet getFacet(Class name)
name
- the required class of facet
public void setFacetList(List facetList)
facetList
- the list of facetspublic void convertFacetValues() throws SchemaException
SchemaException
public Iterator<Facet> getFacets()
Facet
public 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 normalization
public 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 declaration
SchemaException
- if the derivation is not allowedpublic boolean validate(SchemaCompiler compiler) throws SchemaException, UnresolvedReferenceException
validate
in interface UserSchemaComponent
compiler
- used for error reporting
SchemaException
- 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 context
XPathException
- if the expression will never deliver a value of the correct typepublic final SequenceIterator getTypedValue(NodeInfo node) throws XPathException
getTypedValue
in interface SchemaType
node
- the node whose typed value is required
AtomicValue
XPathException
public Value atomize(NodeInfo node) throws XPathException
getTypedValue(net.sf.saxon.om.NodeInfo)
. However, this method is often more convenient and may be
more efficient, especially in the common case where the value is expected to be a singleton.
atomize
in interface SchemaType
node
- the node whose typed value is required
XPathException
public static String isTypeDerivationOK(SimpleType d, SchemaType b, int derivation)
d
- the derived typeb
- the base typederivation
- the disallowed derivations, as a bit-significant integer
public List getLocalFacetList()
public CharSequence preprocess(CharSequence input) throws ValidationException
preprocess
in interface SimpleType
input
- the value to be preprocessed
ValidationException
public 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 string
ValidationException
public ValidationFailure checkAgainstFacets(Value primitiveValue, CharSequence lexicalValue, Iterator iter)
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.iter
- Iterator over the facets to be checked: can be obtained using one of the various
getFacets() methods.
public void elaborate(SchemaCompiler compiler) throws SchemaException
elaborate
in interface UserSchemaComponent
elaborate
in class SchemaStructure
compiler
-
SchemaException
public void serialize(SchemaModelSerializer serializer) throws XPathException
serialize
in interface SerializableSchemaComponent
XPathException
protected abstract void serializeVariety(SchemaModelSerializer serializer) throws XPathException
XPathException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |