com.saxonica.sdoc
Class SimpleTypeDefinition

java.lang.Object
  extended bycom.saxonica.schema.SchemaStructure
      extended bycom.saxonica.schema.SchemaTypeImpl
          extended bycom.saxonica.schema.UserSimpleType
              extended bycom.saxonica.sdoc.SimpleTypeDefinition
All Implemented Interfaces:
SchemaComponent, SchemaType, java.io.Serializable, SimpleType, javax.xml.transform.SourceLocator, UserSchemaComponent

public class SimpleTypeDefinition
extends UserSimpleType
implements UserSchemaComponent

A simple type definition holds all the information about a simpleType during the course of schema processing. On completion of schema processing, more specific objects are created, for example ListType, AtomicType, or UnionType, and the SimpleTypeDefinition is then discarded.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.saxonica.schema.SchemaTypeImpl
finalProhibitions
 
Fields inherited from interface net.sf.saxon.type.SchemaComponent
FIXED_UP, INCOMPLETE, INVALID, UNVALIDATED, VALIDATED, VALIDATING
 
Fields inherited from interface net.sf.saxon.type.SchemaType
DERIVATION_EXTENSION, DERIVATION_LIST, DERIVATION_RESTRICTION, DERIVATION_UNION, DERIVE_BY_SUBSTITUTION
 
Constructor Summary
SimpleTypeDefinition(PreparedSchema schema)
           
 
Method Summary
 void addMemberType(TypeReference memberType)
           
 boolean fixup(PreparedSchema schema)
          Check references from this component to other components
 AtomicType getCommonAtomicType()
          Get the most specific possible atomic type that all items in this SimpleType belong to
 java.util.List getFacetList()
          Return all the facets for this type
 UserSimpleType getSimpleType()
          Get the simple type created for this definition
 SequenceIterator getTypedValue(java.lang.CharSequence value, NamespaceResolver resolver, NameChecker nameChecker)
          Get the typed value corresponding to a given string value, assuming it is valid against this type
 void setIsSimpleContent(boolean b)
          Indicate that this simple type represents the content type of a complex type with simple content
 void setItemTypeReference(TypeReference itemType)
           
 boolean validate(PreparedSchema schema)
          Checks the validity of this SimpleType definition.
 ValidationException validateContent(java.lang.CharSequence value, NamespaceResolver nsResolver, NameChecker nameChecker)
          Check whether a given input string is valid according to this SimpleType
 
Methods inherited from class com.saxonica.schema.UserSimpleType
analyzeContentExpression, applyWhitespaceNormalization, atomize, getBuiltInBaseType, getFacet, getFacetCollection, getFacets, getFacets, getTypedValue, getWhitespaceAction, isAtomicType, isListType, isNamespaceSensitive, isSimpleType, isTypeDerivationOK, isTypeDerivationOK, isUnionType, setFacetCollection
 
Methods inherited from class com.saxonica.schema.SchemaTypeImpl
allowsDerivation, containingDeclarationIsElement, getBaseType, getBaseTypeFingerprint, getBaseTypeReference, getBlock, getContainingDeclarationName, getDerivationMethod, getDescription, getDisplayName, getFingerprint, getLocalName, getNameCode, getNamePool, isComplexType, isSameType, setBaseTypeReference, setContainingDeclaration, setDerivationMethod, setDerivationMethodName, setFinalProhibitions, setLocalName, setNameCode, setNamePool
 
Methods inherited from class com.saxonica.schema.SchemaStructure
getColumnNumber, getFixupStatus, getLineNumber, getPublicId, getSchema, getSystemId, getValidationStatus, lookForCycles, setFixupStatus, setLineNumber, setLocator, setSchema, setSystemId, setValidationStatus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.saxonica.schema.UserSchemaComponent
lookForCycles
 
Methods inherited from interface net.sf.saxon.type.SchemaComponent
getValidationStatus
 
Methods inherited from interface net.sf.saxon.type.SchemaType
allowsDerivation, getBaseType, getBlock, getDerivationMethod, getDescription, getDisplayName, getFingerprint, getNameCode, isComplexType, isSameType
 

Constructor Detail

SimpleTypeDefinition

public SimpleTypeDefinition(PreparedSchema schema)
Method Detail

setItemTypeReference

public void setItemTypeReference(TypeReference itemType)

setIsSimpleContent

public void setIsSimpleContent(boolean b)
Indicate that this simple type represents the content type of a complex type with simple content

Parameters:
b - true if this is the content type of a complex type with simple content

addMemberType

public void addMemberType(TypeReference memberType)

getSimpleType

public UserSimpleType getSimpleType()
Get the simple type created for this definition


getCommonAtomicType

public AtomicType getCommonAtomicType()
Get the most specific possible atomic type that all items in this SimpleType belong to

Specified by:
getCommonAtomicType in interface SimpleType
Returns:
the lowest common supertype of all member types

fixup

public boolean fixup(PreparedSchema schema)
              throws SchemaException
Check references from this component to other components

Specified by:
fixup in interface UserSchemaComponent
Parameters:
schema - The schema is used for reporting errors
Returns:
true if all is well, false if errors found
Throws:
SchemaException

getFacetList

public java.util.List getFacetList()
Return all the facets for this type

Returns:
the list of facets defined on this simple type (this doesn't include inherited facets)

validate

public boolean validate(PreparedSchema schema)
                 throws SchemaException,
                        ValidationException
Checks the validity of this SimpleType definition.

Specified by:
validate in interface UserSchemaComponent
Overrides:
validate in class UserSimpleType
Parameters:
schema - a Schema used for error reporting
Throws:
SchemaException - when this SimpleType definition is invalid.
ValidationException

getTypedValue

public SequenceIterator getTypedValue(java.lang.CharSequence value,
                                      NamespaceResolver resolver,
                                      NameChecker nameChecker)
                               throws ValidationException
Get the typed value corresponding to a given string value, assuming it is valid against this type

Specified by:
getTypedValue in interface SimpleType
Parameters:
value - the string value
resolver - a namespace resolver used to resolve prefixes in QNames and notations
nameChecker -
Returns:
an iterator over the atomic sequence comprising the typed value
Throws:
ValidationException

validateContent

public ValidationException validateContent(java.lang.CharSequence value,
                                           NamespaceResolver nsResolver,
                                           NameChecker nameChecker)
Check whether a given input string is valid according to this SimpleType

Specified by:
validateContent in interface SimpleType
Parameters:
value - the input string to be checked
nsResolver - 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.
nameChecker -
Returns:
null if validation succeeds; return a ValidationException describing the validation failure if validation fails. Note that the exception is returned rather than being thrown.
Throws:
java.lang.UnsupportedOperationException - if the type is namespace-sensitive and no namespace resolver is supplied