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


com.saxonica.schema
Class UserComplexType

java.lang.Object
  |
  +--net.sf.saxon.type.SchemaType
        |
        +--com.saxonica.schema.UserComplexType
All Implemented Interfaces:
CircularityChecker, ComplexType, SchemaComponent, SchemaDeclaration, java.io.Serializable, javax.xml.transform.SourceLocator

public class UserComplexType
extends SchemaType
implements CircularityChecker, SchemaComponent, ComplexType

A user-defined complex type (that is, any complex type other than xs:anyType)

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
UserComplexType(Schema schema, javax.xml.transform.SourceLocator locator)
          Creates a new Complextype with the given name
 
Method Summary
 void addAttributeDecl(AttributeDecl attrDecl)
          Adds the given AttributeDecl to this UserComplexType.
 void addAttributeGroupReference(AttributeGroupReference attrGroupRef)
          Adds the given AttributeGroupReference to this UserComplexType
 void cancelValidation()
          Cancel validation and compilation: this happens when the complex type is redefined
 void compile(Schema schema)
          Compile the finite-state machine for validating instances against this type
 boolean computeIsAllContent()
          Compute whether this complex type has a content model defined by an xs:all compositor
 boolean fixup(Schema schema)
          Check references from this component to other components
 AllCompositor getAllCompositor()
          For a complex type with "all" content, get the "all" compositor
 AttributeGroup getAttributeGroup()
          Returns the attribute group containing details of all the attributes defined for this complex type.
 SchemaType getBaseType()
          Returns the base type that this type inherits from.
 int getBlock()
          Returns the value of the 'block' attribute for this element
 AttributeGroupDecl getCombinedAttributeGroup()
          Returns the attribute group containing details of all the attributes defined for this complex type.
 Particle getExtendedParticle(Schema schema)
          Get the particle corresponding to this UserComplexType, combining it with the content model of the base type if this type is derived by extension.
 AutomatonState getInitialState()
          Get the initial state of the finite state machine used for validating against this type.
 SimpleType getSimpleContentType()
          For a complex type with simple content, return the simple type of the content.
 short getStructureType()
          Returns the type of this Schema Structure
 SequenceIterator getTypedValue(NodeInfo node)
          Get the typed value of a node that is annotated with this schema type
 boolean isAbstract()
          Returns true if this UserComplexType has been marked as Abstract.
 boolean isAllContent()
          Test whether this complex type has "all" content, that is, a content model using an xs:all compositor
 boolean isComplexContent()
          Returns true if this complexType is a 'complexContent'
 boolean isEmptiable()
          Test whether the content model of this complexType allows empty content
 boolean isEmptyContent()
          Test whether the contentType of this complexType is empty
 boolean isMixedContent()
          Test whether this complex type allows mixed content
 boolean isRestricted()
          Returns true if this complexType is a restriction
 boolean isSimpleContent()
          Returns true if this complexType is a 'simpleContent'
 boolean isSimpleType()
          Returns true if this SchemaType is a SimpleType
 boolean isValidRestriction(SchemaType base, SchemaMarker schema)
          Determine whether this type is a valid restriction of another type
 void lookForCycles(Schema schema, java.util.Stack references)
          This method is called to look for cycles.
 void recompile(Schema schema)
          Recompile the complex type when new members are added to the substitution group of an element
 void setAbstract(boolean isAbstract)
          Sets whether or not this UserComplexType should be abstract.
 void setAnyAttribute(AttributeWildcard wildcard)
          Sets the wildcard (anyAttribute) of the complexType.
 void setBaseType(SchemaType baseType)
          Sets the base type for this UserComplexType
 void setBlock(int block)
          Sets the value of the 'block' attribute for this UserComplexType.
 void setComplexContent(boolean complexContent)
          Sets whether or not this complexType is a 'complexContent'
 void setMixed(boolean isMixed)
           
 void setParticle(Particle particle)
          Sets the particle representing the content model of this complex type
 void setRestriction(boolean restricted)
          Sets whether or not this complexType is a restriction
 void setSimpleContent(boolean simpleContent)
           
 void setSimpleContentType(SimpleType type)
           
 boolean validate(Schema schema)
          Checks the validity of this UserComplexType defintion.
 
Methods inherited from class net.sf.saxon.type.SchemaType
allowsDerivation, checkDerivation, containingDeclarationIsElement, getBaseTypeFingerprint, getColumnNumber, getContainingDeclarationName, getDerivationMethod, getDescription, getDisplayName, getFingerprint, getLineNumber, getLocalName, getNamePool, getPublicId, getSystemId, isComplexType, 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

UserComplexType

public UserComplexType(Schema schema,
                       javax.xml.transform.SourceLocator locator)
Creates a new Complextype with the given name

Parameters:
schema - the owning Schema
Method Detail

isSimpleType

public boolean isSimpleType()
Returns true if this SchemaType is a SimpleType

Specified by:
isSimpleType in interface ComplexType
Specified by:
isSimpleType in class SchemaType
Returns:
false

addAttributeDecl

public void addAttributeDecl(AttributeDecl attrDecl)
Adds the given AttributeDecl to this UserComplexType. Doesn't throw an error if it's a duplicate: this is left to be checked at validation time

Parameters:
attrDecl - the AttributeDecl to add to this UserComplexType

addAttributeGroupReference

public void addAttributeGroupReference(AttributeGroupReference attrGroupRef)
Adds the given AttributeGroupReference to this UserComplexType

Parameters:
attrGroupRef - the AttributeGroupReference to add to this UserComplexType

getAttributeGroup

public AttributeGroup getAttributeGroup()
Returns the attribute group containing details of all the attributes defined for this complex type. This method does not include the attributes defined on the base type.

Returns:
an AttributeGroup holding the attribute details

getCombinedAttributeGroup

public AttributeGroupDecl getCombinedAttributeGroup()
Returns the attribute group containing details of all the attributes defined for this complex type. This method also includes the attributes defined on the base type (if derived by extension).

Returns:
an AttributeGroup holding the attribute details

getBaseType

public SchemaType getBaseType()
Returns the base type that this type inherits from.

Specified by:
getBaseType in interface ComplexType
Overrides:
getBaseType in class SchemaType
Returns:
the base type (also called super type).

getBlock

public int getBlock()
Returns the value of the 'block' attribute for this element

Overrides:
getBlock in class SchemaType
Returns:
the value of the 'block' attribute for this element

isAbstract

public boolean isAbstract()
Returns true if this UserComplexType has been marked as Abstract.

Specified by:
isAbstract in interface ComplexType
Returns:
true if this UserComplexType is "abstract".

isComplexContent

public boolean isComplexContent()
Returns true if this complexType is a 'complexContent'

Specified by:
isComplexContent in interface ComplexType
Returns:
true if this complexType is a 'complexContent'

isSimpleContent

public boolean isSimpleContent()
Returns true if this complexType is a 'simpleContent'

Specified by:
isSimpleContent in interface ComplexType
Returns:
true if this complexType is a 'simpleContent'

setSimpleContent

public void setSimpleContent(boolean simpleContent)

isAllContent

public boolean isAllContent()
Test whether this complex type has "all" content, that is, a content model using an xs:all compositor

Specified by:
isAllContent in interface ComplexType

computeIsAllContent

public boolean computeIsAllContent()
Compute whether this complex type has a content model defined by an xs:all compositor


getAllCompositor

public AllCompositor getAllCompositor()
For a complex type with "all" content, get the "all" compositor


getSimpleContentType

public SimpleType getSimpleContentType()
For a complex type with simple content, return the simple type of the content. Otherwise, return null.

Specified by:
getSimpleContentType in interface ComplexType
Returns:
For a complex type with simple content, returns the simple type of the content. Otherwise, returns null.

setSimpleContentType

public void setSimpleContentType(SimpleType type)

isRestricted

public boolean isRestricted()
Returns true if this complexType is a restriction

Specified by:
isRestricted in interface ComplexType
Returns:
true if this complexType is a restriction

isEmptyContent

public boolean isEmptyContent()
Test whether the contentType of this complexType is empty

Specified by:
isEmptyContent in interface ComplexType
Returns:
true if the content model is defined as empty

setAbstract

public void setAbstract(boolean isAbstract)
Sets whether or not this UserComplexType should be abstract.

Parameters:
isAbstract - a boolean that when true makes this UserComplexType abstract.

setAnyAttribute

public void setAnyAttribute(AttributeWildcard wildcard)
Sets the wildcard (anyAttribute) of the complexType. It is the caller's responsibility to check that there can be at most one attribute wildcard in a complex type definition.


setBaseType

public void setBaseType(SchemaType baseType)
Sets the base type for this UserComplexType

Overrides:
setBaseType in class SchemaType
Parameters:
baseType - the base type which this UserComplexType extends or restricts

setBlock

public void setBlock(int block)
Sets the value of the 'block' attribute for this UserComplexType.

Parameters:
block - the value of the block attribute for this UserComplexType definition, as a bit-significant integer.

setComplexContent

public void setComplexContent(boolean complexContent)
Sets whether or not this complexType is a 'complexContent'

Parameters:
complexContent - true if this complexType is a 'complexContent'

setMixed

public void setMixed(boolean isMixed)

isMixedContent

public boolean isMixedContent()
Description copied from interface: ComplexType
Test whether this complex type allows mixed content

Specified by:
isMixedContent in interface ComplexType
Returns:
true if mixed content is allowed

setRestriction

public void setRestriction(boolean restricted)
Sets whether or not this complexType is a restriction

Parameters:
restricted - true if this complexType is a restriction

setParticle

public void setParticle(Particle particle)
                 throws SchemaException
Sets the particle representing the content model of this complex type

Parameters:
particle - the Particle to add
Throws:
SchemaException - if the particle cannot be added (for example, because there is another with the same name in the same scope)

getStructureType

public short getStructureType()
Returns the type of this Schema Structure

Returns:
the type of this Schema Structure

lookForCycles

public void lookForCycles(Schema schema,
                          java.util.Stack references)
                   throws SchemaException
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 CircularityChecker
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.
Throws:
SchemaException

fixup

public boolean fixup(Schema schema)
              throws SchemaException
Description copied from interface: SchemaComponent
Check references from this component to other components

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

validate

public boolean validate(Schema schema)
                 throws javax.xml.transform.TransformerException
Checks the validity of this UserComplexType defintion.

Specified by:
validate in interface SchemaComponent
Parameters:
schema - if this is not null, any errors that are detected should be reported using the error() method of this schema.
Returns:
true when this Schema definition is valid, otherwise false.
Throws:
javax.xml.transform.TransformerException - if the ErrorListener decides that an error is fatal.

isValidRestriction

public boolean isValidRestriction(SchemaType base,
                                  SchemaMarker schema)
                           throws SchemaException
Determine whether this type is a valid restriction of another type

SchemaException

compile

public void compile(Schema schema)
             throws SchemaException
Compile the finite-state machine for validating instances against this type

SchemaException

recompile

public void recompile(Schema schema)
               throws SchemaException
Recompile the complex type when new members are added to the substitution group of an element

SchemaException

cancelValidation

public void cancelValidation()
Cancel validation and compilation: this happens when the complex type is redefined


getInitialState

public AutomatonState getInitialState()
Get the initial state of the finite state machine used for validating against this type.

Returns:
the initial state of the machine. If this is null, then the complex type has an empty content model.

getExtendedParticle

public Particle getExtendedParticle(Schema schema)
                             throws SchemaException
Get the particle corresponding to this UserComplexType, combining it with the content model of the base type if this type is derived by extension.

SchemaException

isEmptiable

public boolean isEmptiable()
                    throws SchemaException
Test whether the content model of this complexType allows empty content

Specified by:
isEmptiable in interface ComplexType
Returns:
true if empty content is valid
SchemaException

getTypedValue

public SequenceIterator getTypedValue(NodeInfo node)
                               throws XPathException
Get the typed value of a node that is annotated with this schema type

Specified by:
getTypedValue in class SchemaType
Parameters:
node - the node whose typed value is required
Returns:
a SequenceIterator over the atomic values making up the typed value of the specified node. The objects returned by this iterator are of type AtomicValue
XPathException


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