Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.saxonica.schema
Class AttributeGroupDecl

    java.lang.Object
      com.saxonica.schema.SchemaStructure
          com.saxonica.schema.AttributeGroupDecl

All Implemented Interfaces:
  SchemaComponent, java.io.Serializable, javax.xml.transform.SourceLocator, UserSchemaComponent

public final class AttributeGroupDecl
extends SchemaStructure
implements UserSchemaComponent

An XML Schema Attribute Group Declaration. This represents a named attribute group, but not an attribute group reference. As well as attribute groups explicitly written in the schema using xsl:attributeGroup, this class is also used to represent any collection of attributes defined using xsl:attribute elements as part of a complex type definition.

In contrast with the Attribute Group Definition schema component as defined in the W3C specification, the model retains explicit references to subsidiary attribute group definitions. However, the method `getAttributeUses()` performs the transitive closure of these references, returning all the attributes at the leaves of the tree.

See Also:
  Serialized Form

Field Summary

Fields inherited from interface net.sf.saxon.type.SchemaComponent
`FIXED_UP, INCOMPLETE, INVALID, UNVALIDATED, VALIDATED, VALIDATING`

Constructor Summary
`AttributeGroupDecl(PreparedSchema schema)` Creates a new AttributeGroup definition.

Method Summary
`void` | `addAttribute(AttributeUse attrDecl)` Adds the given attribute definition to this AttributeGroup.
`void` | `addReference(AttributeGroupReference attrGroup)` Adds the given AttributeGroupReference to this AttributeGroup.
`boolean` | `fixup(PreparedSchema schema)` Check references from this component to other components
`void` | `gatherAttributeUses(java.util.List list)` Append all attribute declarations contained directly or indirectly in this attribute group to a supplied List.
`AttributeUse` | `getAttributeUse(int fingerprint)` Get the attribute use with a specific name, if there is one.
`java.util.Iterator` | `getAttributeUses()` Returns an Iterator over all the attribute uses of this attribute group.
`AttributeWildcard` | `getAttributeWildcard(PreparedSchema schema)` Get the complete attribute wildcard used in this attribute group.
`IntHashMap` | `getDeclaredAttributes()` Get a HashMap containing all the attributes in this attribute group, expanded recursively.
`java.lang.String` | `getDisplayName()` Returns the name of this AttributeGroup
`int` | `getFingerprint()` Get the fingerprint of the name of the attribute group
`java.util.Iterator` | `getLocalAttributeGroupReferences()` Returns the AttributeGroup references contained locally in this attribute group.
`java.util.Iterator` | `getLocalAttributes()` Returns the attributes defined locally in this attribute group.
`AttributeWildcard` | `getLocalAttributeWildcard()` Get the local attribute wildcard used in this attribute group
`PreparedSchema` | `getSchema()` Get the schema in which this attribute group is defined.
`boolean` | `isSameDeclaration(AttributeGroupDecl other)` Test whether this is the same type as another type.
`boolean` | `isValidRestriction(AttributeGroupDecl base, PreparedSchema schema)` Test whether this attribute group is a valid restriction of another attribute group.
`void` | `lookForCycles(PreparedSchema schema, java.util.Stack references)` Check for cycles in the attribute group.
`void` | `setAnyAttribute(AttributeWildcard wildcard)` Sets the wildcard (anyAttribute) of this attribute Group.
`void` | `setNameCode(int nameCode)` Set the nameCode of the name of this attribute group.
`void` | `setRedefinedAttributeGroupDecl(AttributeGroupDecl other)` Set the attribute group that this attribute group redefines.
`void` | `setSchema(PreparedSchema schema)` Set the schema that this attribute group belongs to.
`boolean` | `validate(PreparedSchema schema)` Checks the validity of this AttributeGroup declaration.

Methods inherited from class com.saxonica.schema.SchemaStructure
`getColumnNumber, getFixupStatus, getLineNumber, getPublicId, getSystemId, getValidationStatus, setFixupStatus, setLineNumber, setLocator, 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.SchemaComponent
`getValidationStatus`

Constructor Detail

### AttributeGroupDecl

    public AttributeGroupDecl(PreparedSchema schema)

  Creates a new AttributeGroup definition. For internal use only.

Parameters:
  `schema` - the Schema that this AttributeGroup belongs to.

Method Detail

### addAttribute

    public void addAttribute(AttributeUse attrDecl)

  Adds the given attribute definition to this AttributeGroup. Doesn't throw an error if it's a duplicate: this is left until validation time. For internal use only.

  Parameters:
    `attrDecl` - the Attribute Declaration to add

### addReference

    public void addReference(AttributeGroupReference attrGroup)

  Adds the given AttributeGroupReference to this AttributeGroup. For internal use only.

  Parameters:
    `attrGroup` - the AttributeGroupReference to add

### setRedefinedAttributeGroupDecl

    public void setRedefinedAttributeGroupDecl(AttributeGroupDecl other)

  Set the attribute group that this attribute group redefines. This is called only for an attribute group that redefined another one, *without* a self-reference

### getLocalAttributes

    public java.util.Iterator getLocalAttributes()

  Returns the attributes defined locally in this attribute group. (not those of the nested groups)

  Returns:
    an iterator over the attribute uses defined locally in this attribute group. The objects returned by the iterator are instances of `AttributeDecl`

### getLocalAttributeGroupReferences

    public java.util.Iterator getLocalAttributeGroupReferences()

  Returns the AttributeGroup references contained locally in this attribute group. (not those of the nested groups)

  Returns:
    an iterator over the locally-defined attribute groups. The objects returned by this iterator are instances of `AttributeGroupReference`

### lookForCycles

    public void lookForCycles(PreparedSchema schema,
                              java.util.Stack references)
                       throws SchemaException

  Check for cycles in the attribute group.

  Specified by:
    `lookForCycles` in interface `UserSchemaComponent`
  Overrides:
    `lookForCycles` in class `SchemaStructure`
  Parameters:
    `schema` -
    `references` - The attribute groups that contain direct or indirect references to this attribute group
  Throws:
    `SchemaException` - if a circularity is detected.

### getLocalAttributeWildcard

    public AttributeWildcard getLocalAttributeWildcard()

  Get the local attribute wildcard used in this attribute group

  Returns:
    the wildcard used in this complexType if there is one; otherwise return null.

### getAttributeWildcard

    public AttributeWildcard getAttributeWildcard(PreparedSchema schema)
                                           throws UnresolvedReferenceException

  Get the complete attribute wildcard used in this attribute group. This takes into account any attribute wildcards used in contained attribute groups. The rules are given in Schema Part 1 section 3.4.2. The returned wildcard is the intersection of the attribute wildcards in the various attribute groups: that is, a wildcard that allows only what each one of these wildcards allows.

  Parameters:
    `schema` -
  Returns:
    the combined wildcard used in this attribute group. This can be null. It can also be "inexpressible". This results in an AttributeWildcard marked as being inexpressible, an error condition that the caller is left to deal with.
  Throws:
    `UnresolvedReferenceException`

### getAttributeUses

    public java.util.Iterator getAttributeUses()

  Returns an Iterator over all the attribute uses of this attribute group. The iteration includes attributes from all attribute groups references contained in this AttributeGroup.

  Returns:
    an Iterator over all the attributes of this attribute group, expanded recursively. The objects returned by this Iterator are `AttributeDecl` objects. The iterator does not include attribute wildcards.

### gatherAttributeUses

    public void gatherAttributeUses(java.util.List list)

  Append all attribute declarations contained directly or indirectly in this attribute group to a supplied List. The AttributeGroupDecl must have been validated before this method is called.

### getDisplayName

    public java.lang.String getDisplayName()

  Returns the name of this AttributeGroup

  Returns:
    the name of this AttributeGroup, or null, if no name was defined.

### setAnyAttribute

    public void setAnyAttribute(AttributeWildcard wildcard)

  Sets the wildcard (anyAttribute) of this attribute Group. It is the caller's responsibility to ensure that only one attribute wildcard is defined in an attribute group.

### fixup

    public boolean fixup(PreparedSchema schema)
                  throws SchemaException

  Check references from this component to other components

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

### validate

    public boolean validate(PreparedSchema schema)
                     throws SchemaException,
                            ValidationException

  Checks the validity of this AttributeGroup declaration. For internal use only. Any errors found are reported to the error listener.

  Specified by:
    `validate` in interface `UserSchemaComponent`
  Parameters:
    `schema` - the containing schema, used for error reporting
  Returns:
    true if the declaration is valid, false if not
  Throws:
    `SchemaException` - if this Attribute declaration is invalid and the error listener chooses to treat the error as fatal.
    `ValidationException`

### isValidRestriction

    public boolean isValidRestriction(AttributeGroupDecl base,
                                      PreparedSchema schema)
                               throws SchemaException,
                                      ValidationException

  Test whether this attribute group is a valid restriction of another attribute group. If it is not a valid restriction, an error is reported to the error listener and the method returns false.

  Parameters:
    `base` - the other attribute group
    `schema` - the containing schema (used for reporting errors)
  Returns:
    true if this is a valid restriction, false if not
  Throws:
    `SchemaException` - if an error is detected and the error listener decides to treat the error as fatal.
    `ValidationException`

### isSameDeclaration

    public boolean isSameDeclaration(AttributeGroupDecl other)

  Test whether this is the same type as another type. They are considered to be the same type if they are derived from the same type definition in the original XML representation (which can happen when there are multiple includes of the same file)

### getFingerprint

    public int getFingerprint()

  Get the fingerprint of the name of the attribute group

  Returns:
    the NamePool fingerprint of the attribute group's expanded name

### setNameCode

    public void setNameCode(int nameCode)

  Set the nameCode of the name of this attribute group. For internal use only.

  Parameters:
    `nameCode` - the fingerprint of the name, in the NamePool

### setSchema

    public void setSchema(PreparedSchema schema)

  Set the schema that this attribute group belongs to. For internal use only.

  Overrides:
    `setSchema` in class `SchemaStructure`
  Parameters:
    `schema` - the owning schema

### getSchema

    public PreparedSchema getSchema()

  Get the schema in which this attribute group is defined. May return null in the case of a synthetic attribute group that is not actually defined in a schema

  Overrides:
    `getSchema` in class `SchemaStructure`
  Returns:
    the containing schema

### getDeclaredAttributes

    public IntHashMap getDeclaredAttributes()

  Get a HashMap containing all the attributes in this attribute group, expanded recursively. The key is the integer fingerprint identifying the name of the attribute. The value is an AttributeUse object identifying the attribute declaration.

### getAttributeUse

    public final AttributeUse getAttributeUse(int fingerprint)

  Get the attribute use with a specific name, if there is one. Otherwise return null.

  Parameters:
    `fingerprint` - the fingerprint identifying the expanded name of the required attribute in the name pool.
  Returns:
    the attribute with a given name, from among the transitively-expanded definition of this attribute group.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD