## org.apache.xerces.impl.xs
Class XSComplexTypeDecl

    java.lang.Object
      org.apache.xerces.impl.xs.XSComplexTypeDecl

All Implemented Interfaces:
  org.apache.xerces.xs.XSComplexTypeDefinition, org.apache.xerces.xs.XSObject, org.apache.xerces.xs.XSTypeDefinition, org.w3c.dom.TypeInfo

    public class XSComplexTypeDecl

extends java.lang.Object
implements org.apache.xerces.xs.XSComplexTypeDefinition, org.w3c.dom.TypeInfo

The XML representation for a complexType schema component is a <complexType> element information item

Version:
  $Id: XSComplexTypeDecl.java 573322 2007-09-06 16:48:47Z peterjm $
Author:
  Elena Litani, IBM, Sandy Gao, IBM

# INTERNAL:

  Usage of this class is not supported. It may be altered or removed at any time.

Field Summary

Fields inherited from interface org.apache.xerces.xs.XSComplexTypeDefinition
`CONTENTTYPE_ELEMENT, CONTENTTYPE_EMPTY, CONTENTTYPE_MIXED, CONTENTTYPE_SIMPLE`

Fields inherited from interface org.apache.xerces.xs.XSTypeDefinition
`COMPLEX_TYPE, SIMPLE_TYPE`

Constructor Summary
`XSComplexTypeDecl()`

Method Summary
`boolean` `containsTypeID()`
`boolean` `derivedFrom(java.lang.String ancestorNS, java.lang.String ancestorName, short derivationMethod)` Convenience method which checks if this type is derived from the given ancestor type.
`boolean` `derivedFromType(org.apache.xerces.xs.XSTypeDefinition ancestor, short derivationMethod)` Convenience method which checks if this type is derived from the given `ancestorType`.
`boolean` `getAbstract()` {abstract} A boolean.
`org.apache.xerces.xs.XSObjectList` `getAnnotations()` Optional.
`boolean` `getAnonymous()` A boolean that specifies if the type definition is anonymous.
`XSAttributeGroupDecl` `getAttrGrp()`
`org.apache.xerces.xs.XSAttributeUse` `getAttributeUse(java.lang.String namespace, java.lang.String name)`
`org.apache.xerces.xs.XSObjectList` `getAttributeUses()` {attribute uses} A set of attribute uses.
`org.apache.xerces.xs.XSWildcard` `getAttributeWildcard()` {attribute wildcard} Optional.
`org.apache.xerces.xs.XSTypeDefinition` `getBaseType()` {base type definition} Either a simple type definition or a complex type definition.
`XSCMValidator` `getContentModel(CMBuilder cmBuilder)`
`XSCMValidator` `getContentModel(CMBuilder cmBuilder, boolean forUPA)`
`short` `getContentType()` {content type} One of empty, a simple type definition (see `simpleType`, or mixed, element-only (see `cmParticle`).
`short` `getDerivationMethod()` {derivation method} Either extension or restriction.
`short` `getFinal()` {final} For complex type definition it is a subset of {extension, restriction}.
`short` `getFinalSet()`
`java.lang.String` `getName()` The `name` of this `XSObject` depending on the `XSObject` type.
`java.lang.String` `getNamespace()` The namespace URI of this node, or `null` if it is unspecified.
`org.apache.xerces.xs.XSNamespaceItem` `getNamespaceItem()` A namespace schema information item corresponding to the target namespace of the component, if it is globally declared; or `null` otherwise.
`org.apache.xerces.xs.XSParticle` `getParticle()` A particle for mixed or element-only content model, otherwise `null`
`short` `getProhibitedSubstitutions()` {prohibited substitutions}
`org.apache.xerces.xs.XSSimpleTypeDefinition` `getSimpleType()` A simple type definition corresponding to simple content model, otherwise `null`
`java.lang.String` `getTargetNamespace()`
`short` `getType()` Get the type of the object, i.e ELEMENT_DECLARATION.
`short` `getTypeCategory()` Return whether this type definition is a simple type or complex type.
`java.lang.String` `getTypeName()` The name of a type declared for the associated element or attribute, or `null` if unknown.
`java.lang.String` `getTypeNamespace()` The namespace of the type declared for the associated element or attribute or `null` if the element does not have declaration or if no namespace information is available.
`boolean` `isDerivedFrom(java.lang.String typeNamespaceArg, java.lang.String typeNameArg, int derivationMethod)` This method returns if there is a derivation between the reference type definition, i.e.
`boolean` `isDOMDerivedFrom(java.lang.String ancestorNS, java.lang.String ancestorName, int derivationMethod)` Checks if a type is derived from another given the the name, namespace and derivation method.
`boolean` `isFinal(short derivation)` {final} For complex type definition it is a subset of {extension, restriction}.
`boolean` `isProhibitedSubstitution(short prohibited)` {prohibited substitutions} A subset of {extension, restriction}.
`void` `reset()`
`void` `setContainsTypeID()`
`void` `setIsAbstractType()`
`void` `setIsAnonymous()`
`void` `setName(java.lang.String name)`
`void` `setValues(java.lang.String name, java.lang.String targetNamespace, org.apache.xerces.xs.XSTypeDefinition baseType, short derivedBy, short schemaFinal, short block, short contentType, boolean isAbstract, XSAttributeGroupDecl attrGrp, XSSimpleType simpleType, XSParticleDecl particle, XSObjectListImpl annotations)`
`java.lang.String` `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### XSComplexTypeDecl

    public XSComplexTypeDecl()

Method Detail

### setValues

    public void setValues(java.lang.String name,
                          java.lang.String targetNamespace,
                          org.apache.xerces.xs.XSTypeDefinition baseType,
                          short derivedBy,
                          short schemaFinal,
                          short block,
                          short contentType,
                          boolean isAbstract,
                          XSAttributeGroupDecl attrGrp,
                          XSSimpleType simpleType,
                          XSParticleDecl particle,
                          XSObjectListImpl annotations)

### setName

    public void setName(java.lang.String name)

### getTypeCategory

    public short getTypeCategory()

  Description copied from interface: `org.apache.xerces.xs.XSTypeDefinition`
  Return whether this type definition is a simple type or complex type.

  Specified by:
    `getTypeCategory` in interface `org.apache.xerces.xs.XSTypeDefinition`

### getTypeName

    public java.lang.String getTypeName()

  Description copied from interface: `org.w3c.dom.TypeInfo`
  The name of a type declared for the associated element or attribute, or `null` if unknown.

  Specified by:
    `getTypeName` in interface `org.w3c.dom.TypeInfo`

### getFinalSet

    public short getFinalSet()

### getTargetNamespace

    public java.lang.String getTargetNamespace()

### containsTypeID

    public boolean containsTypeID()

### setIsAbstractType

    public void setIsAbstractType()

### setContainsTypeID

    public void setContainsTypeID()

### setIsAnonymous

    public void setIsAnonymous()

### getContentModel

    public XSCMValidator getContentModel(CMBuilder cmBuilder)

### getContentModel

    public XSCMValidator getContentModel(CMBuilder cmBuilder,
                                         boolean forUPA)

### getAttrGrp

    public XSAttributeGroupDecl getAttrGrp()

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### derivedFromType

    public boolean derivedFromType(org.apache.xerces.xs.XSTypeDefinition ancestor,
                                   short derivationMethod)

  Description copied from interface: `org.apache.xerces.xs.XSTypeDefinition`
  Convenience method which checks if this type is derived from the given `ancestorType`.

  Specified by:
    `derivedFromType` in interface `org.apache.xerces.xs.XSTypeDefinition`
  Parameters:
    `ancestor` - An ancestor type definition.
    `derivationMethod` - A bit combination representing a subset of { `DERIVATION_RESTRICTION, DERIVATION_EXTENSION, DERIVATION_UNION, DERIVATION_LIST` }.
  Returns:
    True if this type is derived from `ancestorType` using only derivation methods from the `derivationMethod` .

### derivedFrom

    public boolean derivedFrom(java.lang.String ancestorNS,
                               java.lang.String ancestorName,
                               short derivationMethod)

  Description copied from interface: `org.apache.xerces.xs.XSTypeDefinition`
  Convenience method which checks if this type is derived from the given ancestor type.

  Specified by:
    `derivedFrom` in interface `org.apache.xerces.xs.XSTypeDefinition`
  Parameters:
    `ancestorNS` - An ancestor type namespace.
    `ancestorName` - An ancestor type name.
    `derivationMethod` - A bit combination representing a subset of { `DERIVATION_RESTRICTION, DERIVATION_EXTENSION, DERIVATION_UNION, DERIVATION_LIST` }.
  Returns:
    True if this type is derived from `ancestorType` using only derivation methods from the `derivationMethod` .

### isDOMDerivedFrom

    public boolean isDOMDerivedFrom(java.lang.String ancestorNS,
                                    java.lang.String ancestorName,
                                    int derivationMethod)

  Checks if a type is derived from another given the the name, namespace and derivation method. See: http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#TypeInfo-isDerivedFrom

  Parameters:
    `ancestorNS` - The namspace of the ancestor type declaration
    `ancestorName` - The name of the ancestor type declaration
    `derivationMethod` - The derivation method
  Returns:
    boolean True if the ancestor type is derived from the reference type by the specifiied derivation method.

### reset

    public void reset()

### getType

    public short getType()

  Get the type of the object, i.e ELEMENT_DECLARATION.

  Specified by:
    `getType` in interface `org.apache.xerces.xs.XSObject`

### getName

    public java.lang.String getName()

  The `name` of this `XSObject` depending on the `XSObject` type.

  Specified by:
    `getName` in interface `org.apache.xerces.xs.XSObject`

### getAnonymous

    public boolean getAnonymous()

  A boolean that specifies if the type definition is anonymous. Convenience attribute. This is a field is not part of XML Schema component model.

  Specified by:
    `getAnonymous` in interface `org.apache.xerces.xs.XSTypeDefinition`

### getNamespace

    public java.lang.String getNamespace()

  The namespace URI of this node, or `null` if it is unspecified. defines how a namespace URI is attached to schema components.

  Specified by:
    `getNamespace` in interface `org.apache.xerces.xs.XSObject`

### getBaseType

    public org.apache.xerces.xs.XSTypeDefinition getBaseType()

  {base type definition} Either a simple type definition or a complex type definition.

  Specified by:
    `getBaseType` in interface `org.apache.xerces.xs.XSTypeDefinition`

### getDerivationMethod

    public short getDerivationMethod()

  {derivation method} Either extension or restriction. The valid constant value for this `XSConstants` EXTENTION, RESTRICTION.

  Specified by:
    `getDerivationMethod` in interface `org.apache.xerces.xs.XSComplexTypeDefinition`

### isFinal

    public boolean isFinal(short derivation)

  {final} For complex type definition it is a subset of {extension, restriction}. For simple type definition it is a subset of {extension, list, restriction, union}.

  Specified by:
    `isFinal` in interface `org.apache.xerces.xs.XSTypeDefinition`
  Parameters:
    `derivation` - Extension, restriction, list, union constants (defined in `XSConstants`).
  Returns:
    True if derivation is in the final set, otherwise false.

### getFinal

    public short getFinal()

  {final} For complex type definition it is a subset of {extension, restriction}.

  Specified by:
    `getFinal` in interface `org.apache.xerces.xs.XSTypeDefinition`
  Returns:
    A bit flag that represents: {extension, restriction) or none for complexTypes; {extension, list, restriction, union} or none for simpleTypes;

### getAbstract

    public boolean getAbstract()

  {abstract} A boolean. Complex types for which {abstract} is true must not be used as the {type definition} for the validation of element information items.

  Specified by:
    `getAbstract` in interface `org.apache.xerces.xs.XSComplexTypeDefinition`

### getAttributeUses

    public org.apache.xerces.xs.XSObjectList getAttributeUses()

  {attribute uses} A set of attribute uses.

  Specified by:
    `getAttributeUses` in interface `org.apache.xerces.xs.XSComplexTypeDefinition`

### getAttributeWildcard

    public org.apache.xerces.xs.XSWildcard getAttributeWildcard()

  {attribute wildcard} Optional. A wildcard.

  Specified by:
    `getAttributeWildcard` in interface `org.apache.xerces.xs.XSComplexTypeDefinition`

### getContentType

    public short getContentType()

  {content type} One of empty, a simple type definition (see `simpleType`, or mixed, element-only (see `cmParticle`).

  Specified by:
    `getContentType` in interface `org.apache.xerces.xs.XSComplexTypeDefinition`

### getSimpleType

    public org.apache.xerces.xs.XSSimpleTypeDefinition getSimpleType()

  A simple type definition corresponding to simple content model, otherwise `null`

  Specified by:
    `getSimpleType` in interface `org.apache.xerces.xs.XSComplexTypeDefinition`

### getParticle

    public org.apache.xerces.xs.XSParticle getParticle()

  A particle for mixed or element-only content model, otherwise `null`

  Specified by:
    `getParticle` in interface `org.apache.xerces.xs.XSComplexTypeDefinition`

### isProhibitedSubstitution

    public boolean isProhibitedSubstitution(short prohibited)

  {prohibited substitutions} A subset of {extension, restriction}.

  Specified by:
    `isProhibitedSubstitution` in interface `org.apache.xerces.xs.XSComplexTypeDefinition`
  Parameters:
    `prohibited` - extention or restriction constants (defined in `XSConstants`).
  Returns:
    True if prohibited is a prohibited substitution, otherwise false.

### getProhibitedSubstitutions

    public short getProhibitedSubstitutions()

  {prohibited substitutions}

  Specified by:
    `getProhibitedSubstitutions` in interface `org.apache.xerces.xs.XSComplexTypeDefinition`
  Returns:
    A bit flag corresponding to prohibited substitutions

### getAnnotations

    public org.apache.xerces.xs.XSObjectList getAnnotations()

  Optional. Annotation.

  Specified by:
    `getAnnotations` in interface `org.apache.xerces.xs.XSComplexTypeDefinition`

### getNamespaceItem

    public org.apache.xerces.xs.XSNamespaceItem getNamespaceItem()

  Description copied from interface: `org.apache.xerces.xs.XSObject`
  A namespace schema information item corresponding to the target namespace of the component, if it is globally declared; or `null` otherwise.

  Specified by:
    `getNamespaceItem` in interface `org.apache.xerces.xs.XSObject`
  See Also:
    `XSObject.getNamespaceItem()`

### getAttributeUse

    public org.apache.xerces.xs.XSAttributeUse getAttributeUse(java.lang.String namespace,
                                                               java.lang.String name)

### getTypeNamespace

    public java.lang.String getTypeNamespace()

  Description copied from interface: `org.w3c.dom.TypeInfo`
  The namespace of the type declared for the associated element or attribute or `null` if the element does not have declaration or if no namespace information is available.

  Specified by:
    `getTypeNamespace` in interface `org.w3c.dom.TypeInfo`

### isDerivedFrom

    public boolean isDerivedFrom(java.lang.String typeNamespaceArg,
                                 java.lang.String typeNameArg,
                                 int derivationMethod)

  Description copied from interface: `org.w3c.dom.TypeInfo`
  This method returns if there is a derivation between the reference type definition, i.e. the `TypeInfo` on which the method is being called, and the other type definition, i.e. the one passed as parameters.

  Specified by:
    `isDerivedFrom` in interface `org.w3c.dom.TypeInfo`
  Parameters:
    `typeNamespaceArg` - the namespace of the other type definition.
    `typeNameArg` - the name of the other type definition.
    `derivationMethod` - the type of derivation and conditions applied between two types, as described in the list of constants provided in this interface.
  Returns:
    If the document's schema is a DTD or no schema is associated with the document, this method will always return `false` . If the document's schema is an XML Schema, the method will `true` if the reference type definition is derived from the other type definition according to the derivation parameter. If the value of the parameter is `0` (no bit is set to `1` for the `derivationMethod` parameter), the method will return `true` if the other type definition can be reached by recursing any combination of {base type definition}, {item type definition}, or {member type definitions} from the reference type definition.

Copyright © 1999-2007 The Apache Software Foundation. All Rights Reserved.