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 AttributeDecl

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

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

public final class AttributeDecl
extends SchemaStructure
implements UserSchemaComponent, SchemaDeclaration

An XML Schema Attribute Declaration. This includes global attribute declarations, local attribute declarations, and "attribute uses". It corresponds to either (a) an attribute declaration schema component for a global attribute, or (b) an attribute declaration schema component for a local attribute, plus an attribute use referencing that attribute declaration, or (c) an attribute use referencing a global attribute declaration.

See Also:
  Serialized Form

Field Summary

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

Constructor Summary
`AttributeDecl(PreparedSchema schema)` Creates a new AttrDecl in the given schema.

Method Summary
`boolean` | `fixup(PreparedSchema schema)` Check references from this component to other components
`java.lang.String` | `getDefaultValue()` Returns the default value of this attribute declaration.
`java.lang.String` | `getDisplayName()` Returns the name of the attribute defined by this AttributeDecl.
`int` | `getFingerprint()` Gets the fingerprint of this attribute name
`Value` | `getFixedValue()` Returns the fixed value of this attribute declaration.
`int` | `getNameCode()` Get the nameCode of the name of this element declaration in the namePool
`SimpleType` | `getSimpleType()` Get the type associated with this Attribute Declaration.
`SchemaType` | `getType()` Get the type: satisfies SchemaDeclaration interface
`boolean` | `isSameDeclaration(AttributeDecl other)` Test whether this is the same type as another type.
`void` | `setDefaultValue(java.lang.String value)` Sets the DEFAULT value.
`void` | `setFixedValue(Value value)` Sets the FIXED value.
`void` | `setNameCode(int nameCode)` Set the fingerprint for this attribute name.
`void` | `setNamespaceResolver(NamespaceResolver resolver)` Set the namespace resolver for resolving QName-valued fixed and default values
`void` | `setSimpleType(UserSimpleType simpleType)` Sets the SimpleType for this attribute declaration.
`void` | `setTypeFingerprint(int fingerprint)` Set the namepool fingerprint of the name of the element's type.
`boolean` | `testFixedValue(java.lang.CharSequence value, NamespaceResolver resolver)` Test a value against the fixed value.
`boolean` | `validate(PreparedSchema schema)` Checks the validity of this Attribute declaration

Methods inherited from class com.saxonica.schema.SchemaStructure
`getColumnNumber, getFixupStatus, getLineNumber, getPublicId, getSchema, getSystemId, getValidationStatus, lookForCycles, setFixupStatus, setLineNumber, setLocator, setSchema, setSystemId, setValidationStatus`

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

Methods inherited from interface com.saxonica.schema.UserSchemaComponent
`lookForCycles`

Methods inherited from interface net.sf.saxon.type.SchemaComponent
`getValidationStatus`

Constructor Detail

### AttributeDecl

    public AttributeDecl(PreparedSchema schema)

  Creates a new AttrDecl in the given schema. For system use only.

Parameters:
  `schema` - the schema that contains the new attrDecl

Method Detail

### getDisplayName

    public java.lang.String getDisplayName()

  Returns the name of the attribute defined by this AttributeDecl. This is used only for diagnostic display purposes

  Returns:
    the name of the attribute as a lexical QName.

### setNameCode

    public void setNameCode(int nameCode)

  Set the fingerprint for this attribute name. For internal use only.

### getFingerprint

    public int getFingerprint()

  Gets the fingerprint of this attribute name

  Returns:
    the fingerprint of the attribute name in the NamePool

### getNameCode

    public int getNameCode()

  Get the nameCode of the name of this element declaration in the namePool

  Returns:
    the nameCode of the element name

### getSimpleType

    public SimpleType getSimpleType()
                             throws UnresolvedReferenceException

  Get the type associated with this Attribute Declaration.

  Returns:
    the type of this attribute.
  Throws:
    `UnresolvedReferenceException`

### getType

    public SchemaType getType()
                       throws UnresolvedReferenceException

  Get the type: satisfies SchemaDeclaration interface

  Specified by:
    `getType` in interface `SchemaDeclaration`
  Throws:
    `UnresolvedReferenceException`

### setTypeFingerprint

    public void setTypeFingerprint(int fingerprint)

  Set the namepool fingerprint of the name of the element's type.

### getDefaultValue

    public java.lang.String getDefaultValue()

  Returns the default value of this attribute declaration.

  Returns:
    the default value defined by this attribute declaration, or null if no default was specified.

### getFixedValue

    public Value getFixedValue()

  Returns the fixed value of this attribute declaration.

  Returns:
    the fixed value defined by this attribute declaration, or null if no fixed value was specified. Once the schema has been compiled this will be the correctly-typed value; until then it will be the string value as specified in the source schema.

### setSimpleType

    public void setSimpleType(UserSimpleType simpleType)

  Sets the SimpleType for this attribute declaration. For internal use only.

  Parameters:
    `simpleType` - the SimpleType for this attribute declaration

### setDefaultValue

    public void setDefaultValue(java.lang.String value)

  Sets the DEFAULT value. For internal use only.

### setFixedValue

    public void setFixedValue(Value value)

  Sets the FIXED value. For internal use only.

### setNamespaceResolver

    public void setNamespaceResolver(NamespaceResolver resolver)

  Set the namespace resolver for resolving QName-valued fixed and default values

### fixup

    public boolean fixup(PreparedSchema schema)
                  throws SchemaException,
                         UnresolvedReferenceException

  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`
    `UnresolvedReferenceException`

### validate

    public boolean validate(PreparedSchema schema)
                     throws SchemaException,
                            ValidationException

  Checks the validity of this Attribute declaration

  Specified by:
    `validate` in interface `UserSchemaComponent`
  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:
    `SchemaException` - if the error listener decides an error is fatal
    `ValidationException`

### testFixedValue

    public boolean testFixedValue(java.lang.CharSequence value,
                                  NamespaceResolver resolver)
                           throws ValidationException

  Test a value against the fixed value. This tests both against the fixed value for this attribute use, and the fixed value of the corresponding attribute declaration (which must be equivalent if they are both present).

  Parameters:
    `value` - the value to be tested
  Returns:
    true if it matches (or if there is no fixed value), false otherwise
  Throws:
    `ValidationException` - if the value is not valid for this type

### isSameDeclaration

    public boolean isSameDeclaration(AttributeDecl 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)

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