## com.saxonica.schema
Class UserUnionType

    java.lang.Object
      com.saxonica.schema.SchemaStructure
          com.saxonica.schema.UserDefinedType
              com.saxonica.schema.UserSimpleType
                  com.saxonica.schema.UserUnionType

All Implemented Interfaces:
  SerializableSchemaComponent, UserSchemaComponent, Serializable, SourceLocator, SchemaComponent, SchemaType, SimpleType

    public class UserUnionType

extends UserSimpleType

A class that represents the XML Schema Union simple-type.

See Also:
  Serialized Form

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
`UserUnionType(EnterpriseConfiguration config)` Creates a new Union type.

Method Summary
`void` `addMemberTypeReference(TypeReference member)` Add a member type to the list of member types
`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.
`AtomicType` `getCommonAtomicType()` Get the most specific possible atomic type that all items in this SimpleType belong to
`List<TypeReference>` `getMemberTypeReferences()` Get the list of member types
`SequenceIterator` `getTypedValue(CharSequence value, NamespaceResolver resolver, ConversionRules rules)` Get the typed value corresponding to a given string value, assuming it is valid against this type
`boolean` `isAtomicType()` Test whether this Simple Type is an atomic type
`boolean` `isBuiltInType()` Determine whether this is a built-in type or a user-defined 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()` Determine whether this is a list type
`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.
`boolean` `isUnionType()` Return true if this type is a union type (that is, if its variety is union)
`Iterator<TypeReference>` `iterateMemberTypeReferences()` Returns an Iterator over all the SimpleTypes that are members of a union type.
`void` `lookForCycles(Stack references, SchemaCompiler compiler)` This method is called to look for cycles.
`void` `serializeVariety(SchemaModelSerializer serializer)` Serialize the schema component
`void` `setMemberTypeReferences(List members)` Set the member types of this union type.
`boolean` `validate(SchemaCompiler compiler)` Validate this Union, replacing all unresolved forwards references at the same time
`ValidationFailure` `validateContent(CharSequence value, NamespaceResolver nsResolver, ConversionRules rules)` Check whether a given input string is valid according to this SimpleType

Methods inherited from class com.saxonica.schema.UserSimpleType
`addFacet, addInheritedFacets, analyzeContentExpression, applyWhitespaceNormalization, atomize, checkAgainstFacets, checkTypeDerivationIsOK, convertFacetValues, getBuiltInBaseType, getExtendedFacetList, getFacet, getFacets, getLocalFacetList, getTypedValue, getWhitespaceAction, isSimpleType, isTypeDerivationOK, mergeEnumerationFacets, postprocess, preprocess, serialize, setFacetList`

Methods inherited from class com.saxonica.schema.UserDefinedType

`allowsDerivation, containingDeclarationIsElement, getBaseType, getBaseTypeFingerprint, getBaseTypeReference, getBlock, getContainingDeclarationName, getDerivationMethod, getDescription, getDisplayName, getFingerprint, getLocalName, getName, getNameCode, getNamePool, getTargetNamespace, hasRegisteredExtension, isAnonymousType, isComplexType, isExternalType, isSameType, iterateExtensionTypes, registerExtensionType, setBaseTypeReference, setContainingDeclaration, setDerivationMethod, setDerivationMethodName, setExtendedTypes, setFinalProhibitions, setNameCode`

Methods inherited from class com.saxonica.schema.SchemaStructure
`fixup, getColumnNumber, getConfiguration, getFixupStatus, getLineNumber, getPublicId, getRedefinitionLevel, getSchemaDocumentURI, getSystemId, getValidationStatus, 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
`isExternalType`

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`

Constructor Detail

### UserUnionType

    public UserUnionType(EnterpriseConfiguration config)

  Creates a new Union type.

  Parameters:
    `config` - the Configuration for this Union (Cannot be null)

Method Detail

### getCommonAtomicType

    public AtomicType getCommonAtomicType()

  Get the most specific possible atomic type that all items in this SimpleType belong to

  Returns:
    the lowest common supertype of all member types

### setMemberTypeReferences

    public void setMemberTypeReferences(List members)

  Set the member types of this union type.

  Parameters:
    `members` - a list of `TypeReference` objects

### addMemberTypeReference

    public void addMemberTypeReference(TypeReference member)

  Add a member type to the list of member types

  Parameters:
    `member` - a reference to a new member type

### getMemberTypeReferences

    public List<TypeReference> getMemberTypeReferences()

  Get the list of member types

  Returns:
    a List containing `TypeReference` objects

### iterateMemberTypeReferences

    public Iterator<TypeReference> iterateMemberTypeReferences()

  Returns an Iterator over all the SimpleTypes that are members of a union type. Note that this is not transitive: if the union has another union as a membertype, the iteration will return this union rather than its members.

  Returns:
    For union types, return an Iterator over all TypeReferences to member SimpleTypes.

### isAtomicType

    public boolean isAtomicType()

  Test whether this Simple Type is an atomic type

  Specified by:
    `isAtomicType` in interface `SchemaType`
  Specified by:
    `isAtomicType` in interface `SimpleType`
  Overrides:
    `isAtomicType` in class `UserSimpleType`
  Returns:
    false, this is not an atomic type

### isIdType

    public boolean isIdType()

  Ask whether this type is an ID type. This is defined to be any simple type who typed value may contain atomic values of type xs:ID: that is, it includes types derived from ID by restriction, list, or union. Note that for a node to be treated as an ID in XSD 1.0, its typed value must be a *single* atomic value of type ID; the type of the node, however, can still allow a list or union. This changes in XSD 1.1, where a list of IDs is allowed.

  Specified by:
    `isIdType` in interface `SchemaType`
  Overrides:
    `isIdType` in class `UserSimpleType`

### isIdRefType

    public boolean isIdRefType()

  Ask whether this type is an IDREF or IDREFS type. This is defined to be any simple type who typed value may contain atomic values of type xs:IDREF: that is, it includes types derived from IDREF or IDREFS by restriction, list, or union

  Specified by:
    `isIdRefType` in interface `SchemaType`
  Overrides:
    `isIdRefType` in class `UserSimpleType`

### isBuiltInType

    public boolean isBuiltInType()

  Determine whether this is a built-in type or a user-defined type

  Returns:
    true if this is a built-in type

### isListType

    public boolean isListType()

  Determine whether this is a list type

  Specified by:
    `isListType` in interface `SimpleType`
  Overrides:
    `isListType` in class `UserSimpleType`
  Returns:
    true if this is a list type

### isUnionType

    public boolean isUnionType()

  Return true if this type is a union type (that is, if its variety is union)

  Specified by:
    `isUnionType` in interface `SimpleType`
  Overrides:
    `isUnionType` in class `UserSimpleType`
  Returns:
    true for a union 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

  Returns:
    true if any of the member types is namespace-sensitive

### validate

    public boolean validate(SchemaCompiler compiler)
                     throws SchemaException

  Validate this Union, replacing all unresolved forwards references at the same time

  Specified by:
    `validate` in interface `UserSchemaComponent`
  Overrides:
    `validate` in class `UserSimpleType`
  Parameters:
    `compiler` - used for error reporting
  Returns:
    true when this Schema definition is valid, otherwise false.
  Throws:
    `SchemaException`

### elaborate

    public void elaborate(SchemaCompiler compiler)
                   throws SchemaException

  Description copied from class: `UserSimpleType`
  Elaborate the schema component: after reloading a serialized schema component model, this expands the component with derived information needed during validation episodes. The model is assumed to be valid.

  Specified by:
    `elaborate` in interface `UserSchemaComponent`
  Overrides:
    `elaborate` in class `UserSimpleType`
  Throws:
    `SchemaException`

### lookForCycles

    public void lookForCycles(Stack references,
                              SchemaCompiler compiler)
                       throws SchemaException,
                              UnresolvedReferenceException

  This method is called to look for cycles. The object implementing this method is required (a) to raise an exception if the object itself appears in the list of references, (b) to add itself to the list of references, and (c) to call the lookForCycles method on all the objects that it references.

  Specified by:
    `lookForCycles` in interface `UserSchemaComponent`
  Overrides:
    `lookForCycles` in class `SchemaStructure`
  Parameters:
    `references` - A list of objects that contain direct or indirect references to this object, and that must therefore not be referred to from this object.
    `compiler` - used for error reporting
  Throws:
    `SchemaException`
    `UnresolvedReferenceException`

### validateContent

    public ValidationFailure validateContent(CharSequence value,
                                             NamespaceResolver nsResolver,
                                             ConversionRules rules)

  Check whether a given input string is valid according to this 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` -
  Returns:
    null if validation succeeds; return a ValidationFailure describing the validation failure if validation fails
  Throws:
    `UnsupportedOperationException` - if the type is namespace-sensitive and no namespace resolver is supplied

### getTypedValue

    public SequenceIterator getTypedValue(CharSequence value,
                                          NamespaceResolver resolver,
                                          ConversionRules rules)
                                   throws ValidationException

  Description copied from interface: `SimpleType`
  Get the typed value corresponding to a given string value, assuming it is valid against this type

  Parameters:
    `value` - the string value
    `resolver` - a namespace resolver used to resolve any namespace prefixes appearing in the content of values. Can supply null, in which case any namespace-sensitive content will be rejected.
  Returns:
    an iterator over the atomic sequence comprising the typed value. The objects returned by this SequenceIterator will all be of type `AtomicValue`, The next() method on the iterator throws no checked exceptions, although it is not actually declared as an UnfailingIterator.
  Throws:
    `ValidationException` - if the supplied value is not in the lexical space of the data type

### serializeVariety

    public void serializeVariety(SchemaModelSerializer serializer)
                          throws XPathException

  Serialize the schema component

  Specified by:
    `serializeVariety` in class `UserSimpleType`
  Throws:
    `XPathException`

Copyright (c) 2004-2010 Saxonica Limited. All rights reserved.