Class SimpleTypeDefinition

    • Constructor Detail

      • SimpleTypeDefinition

        public SimpleTypeDefinition​(EnterpriseConfiguration config)
        Create a SimpleTypeDefinition
        Parameters:
        config - the Saxon configuration
    • Method Detail

      • setItemTypeReference

        public void setItemTypeReference​(TypeReference itemType)
        Set the reference to an item type of this list type
        Parameters:
        itemType - reference to a type forming the item type of this list type
      • isAtomicType

        public boolean isAtomicType()
        Test whether this Simple Type is an atomic type. On a SimpleTypeDefinition, the variety of the type cannot be reliably determined until fixup() has been called to determine the base type.
        Specified by:
        isAtomicType in interface SchemaType
        Specified by:
        isAtomicType in interface SimpleType
        Overrides:
        isAtomicType in class UserSimpleType
        Returns:
        true if this type is known to be atomic
      • isListType

        public boolean isListType()
        On a SimpleTypeDefinition, isListType() always returns true if the type is "derived by List". A list type that is derived by restricting another List type cannot be reliably recognized until fixup() has been called to determine the base type.
        Specified by:
        isListType in interface SimpleType
        Overrides:
        isListType in class UserSimpleType
        Returns:
        true if this type is "derived by List"
      • isUnionType

        public boolean isUnionType()
        On a SimpleTypeDefinition, isUnionType() always returns true if the type is "derived by Union". A union type that is derived by restricting another Union type cannot be reliably recognized until the fixup() method has been called to determine the base type.
        Specified by:
        isUnionType in interface SimpleType
        Overrides:
        isUnionType in class UserSimpleType
        Returns:
        true if this type is "derived by Union"
      • 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)
        Add a member type to this union type
        Parameters:
        memberType - the member type to be added
      • getWorkingType

        public UserSimpleType getWorkingType()
        Get the simple type created for this definition
        Returns:
        the UserSimpleType object if it has been created, otherwise null
      • getTypedValue

        public AtomicSequence getTypedValue​(UnicodeString value,
                                            NamespaceResolver resolver,
                                            ConversionRules rules)
                                     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
        rules - the conversion rules for the Configuration
        Returns:
        an iterator over the atomic sequence comprising the typed value
        Throws:
        ValidationException - if the supplied value is invalid against this simple type
      • isBuiltInType

        public boolean isBuiltInType()
        Determine whether this is a built-in type or a user-defined type
        Specified by:
        isBuiltInType in interface SimpleType
        Returns:
        true if this is a built-in type
      • isNamespaceSensitive

        public boolean isNamespaceSensitive()
        Test whether this type is namespace sensitive, that is, if a namespace context is needed to translate between the lexical space and the value space. This is true for types derived from, or containing, QNames and NOTATIONs
        Specified by:
        isNamespaceSensitive in interface HyperType
        Returns:
        true if the type is namespace-sensitive
      • validateContent

        public ValidationFailure validateContent​(UnicodeString value,
                                                 NamespaceResolver nsResolver,
                                                 ConversionRules rules)
        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.
        rules - the conversion rules for the configuration
        Returns:
        null if validation succeeds; or return a ValidationFailure 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