Free Trial - Stylus Studio, The World's Best XML IDE!


com.saxonica.schema
Class UnionType

java.lang.Object
  |
  +--net.sf.saxon.type.SchemaType
        |
        +--net.sf.saxon.type.SimpleType
              |
              +--com.saxonica.schema.UnionType
All Implemented Interfaces:
java.io.Serializable, javax.xml.transform.SourceLocator

public class UnionType
extends SimpleType

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

See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.sf.saxon.type.SchemaType
ALL_DERIVATIONS, DERIVE_BY_EXTENSION, DERIVE_BY_LIST, DERIVE_BY_RESTRICTION, DERIVE_BY_SUBSTITUTION, DERIVE_BY_UNION, finalProhibitions, INVALID, UNVALIDATED, VALIDATED, VALIDATING, validationPhase
 
Constructor Summary
UnionType(Schema schema)
          Creates a new Union type.
 
Method Summary
 java.util.List getMemberTypes()
          Get the list of member types, as a List containing SimpleType objects
 SequenceIterator getTypedValue(java.lang.CharSequence value, NodeInfo node)
          Get the typed value corresponding to a given string value, assuming it is valid against this type
 boolean isListType()
          Determine whether any member of this union is a list type.
 boolean isUnionType()
          Return true if this type is a union type (that is, if its variety is union)
 java.util.Iterator iterateMemberTypes()
          Returns an Iterator over all the SimpleTypes that are members of a union type.
 void setMemberTypes(java.util.List members)
          Set the member types of this union type
 boolean validate(SchemaMarker schema)
          Validate this Union, replacing all unresolved forwards references at the same time
 void validateContent(java.lang.CharSequence value, NamespaceResolver nsResolver)
          Check whether a given input string is valid according to this SimpleType
 
Methods inherited from class net.sf.saxon.type.SimpleType
applyWhitespaceNormalization, getBuiltInBaseType, getFacet, getFacetCollection, getFacets, getFacets, getTypedValue, getWhitespaceAction, isNamespaceSensitive, isSimpleType, isTypeDerivationOK, setFacetCollection
 
Methods inherited from class net.sf.saxon.type.SchemaType
allowsDerivation, checkDerivation, containingDeclarationIsElement, getBaseType, getBaseTypeFingerprint, getBlock, getColumnNumber, getContainingDeclarationName, getDerivationMethod, getDescription, getDisplayName, getFingerprint, getLineNumber, getLocalName, getNamePool, getPublicId, getSystemId, isComplexType, setBaseType, setBaseTypeFingerprint, setContainingDeclaration, setDerivationMethod, setDerivationMethodName, setFinalProhibitions, setFingerprint, setLineNumber, setLocalName, setLocator, setNamePool, setSystemId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnionType

public UnionType(Schema schema)
          throws SchemaException
Creates a new Union type.

Parameters:
schema - the Schema for this Union (Cannot be null)
Method Detail

setMemberTypes

public void setMemberTypes(java.util.List members)
Set the member types of this union type


getMemberTypes

public java.util.List getMemberTypes()
Get the list of member types, as a List containing SimpleType objects


iterateMemberTypes

public java.util.Iterator iterateMemberTypes()
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.

Overrides:
iterateMemberTypes in class SimpleType
Returns:
For union types, return an Iterator over all member SimpleTypes. For non-union types, return null.

isListType

public boolean isListType()
Determine whether any member of this union is a list type. This is recursive; if a member of the union is a union type containing a list type as one of its members, the result is true.

Overrides:
isListType in class SimpleType
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)

Overrides:
isUnionType in class SimpleType
Returns:
true for a union type

validate

public boolean validate(SchemaMarker schema)
                 throws javax.xml.transform.TransformerException
Validate this Union, replacing all unresolved forwards references at the same time

Overrides:
validate in class SimpleType
Parameters:
schema - a Schema used for error reporting
Throws:
javax.xml.transform.TransformerException

validateContent

public void validateContent(java.lang.CharSequence value,
                            NamespaceResolver nsResolver)
                     throws ValidationException
Description copied from class: SimpleType
Check whether a given input string is valid according to this SimpleType

Specified by:
validateContent in class 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.
Throws:
ValidationException - if the content is invalid

getTypedValue

public SequenceIterator getTypedValue(java.lang.CharSequence value,
                                      NodeInfo node)
                               throws ValidationException
Description copied from class: SimpleType
Get the typed value corresponding to a given string value, assuming it is valid against this type

Specified by:
getTypedValue in class SimpleType
Parameters:
value - the string value
node - the containing node: used only to resolve namespace prefixes in QName-valued content
Returns:
an iterator over the atomic sequence comprising the typed value. The objects returned by this SequenceIterator will all be of type AtomicValue
ValidationException


Stylus Studio features integrated development and debugging support for Saxon in the XQuery editor and XSLT editor.