com.saxonica.schema
Class AttributeGroupReference

java.lang.Object
  extended by com.saxonica.schema.SchemaStructure
      extended by com.saxonica.schema.AttributeGroupReference
All Implemented Interfaces:
ComponentReference, SerializableSchemaComponent, UserSchemaComponent, Serializable, SourceLocator, SchemaComponent

public final class AttributeGroupReference
extends SchemaStructure
implements ComponentReference, UserSchemaComponent

An XML Schema Attribute Group Reference, corresponding to an xs:attributeGroup element with a 'ref' attribute.

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface net.sf.saxon.type.SchemaComponent
FIXED_UP, INCOMPLETE, INVALID, UNVALIDATED, VALIDATED, VALIDATING
 
Fields inherited from interface com.saxonica.schema.SerializableSchemaComponent
ALL_COMPOSITOR, ATOMIC_TYPE, ATTRIBUTE_DECL, ATTRIBUTE_GROUP, ATTRIBUTE_GROUP_REF, ATTRIBUTE_USE, ATTRIBUTE_WILDCARD, CHOICE_COMPOSITOR, COMPLEX_TYPE, ELEMENT_DECL, ELEMENT_PARTICLE, ELEMENT_WILDCARD, FACET, KEY, KEYREF, LIST_TYPE, MODEL_GROUP, MODEL_GROUP_REF, NOTATION, SEQUENCE_COMPOSITOR, UNION_TYPE, UNIQUE
 
Constructor Summary
AttributeGroupReference(PreparedSchema schema, int fingerprint)
          Creates a new AttributeGroup reference
 
Method Summary
 boolean fixup(SchemaCompiler compiler)
          Fix up references to other elements in the schema.
 AttributeWildcard getAttributeWildcard(SchemaCompiler compiler)
          Returns the attribute wildcard in the referenced attribute group, if any.
 int getComponentTypeCode()
          Get a unique number identifying the type of component
 int getFingerprint()
          Get the fingerprint of the target of this reference
 int getSymbolSpace()
          Get the symbol space of the target of this reference
 SchemaComponent getTarget()
          Resolves the attribute group reference Note this method doesn't bind irrevocably to the target attribute group declaration, because this may change following a redefine.
 boolean isResolved()
          Determine whether this reference has been resolved
 void lookForCycles(Stack references, SchemaCompiler compiler)
          Check for cycles in the attribute group.
 void serialize(SchemaSerializer serializer)
          Serialize the schema component
 void setFingerprint(int fingerprint)
          Set the fingerprint of the target of this reference
 void tryToResolve(SchemaCompiler compiler)
          Attempt to resolve this reference using the groups defined in a given schema.
 boolean validate(SchemaCompiler compiler)
          Checks the validity of this Schema component.
 
Methods inherited from class com.saxonica.schema.SchemaStructure
getColumnNumber, getConfiguration, getFixupStatus, getLineNumber, getPublicId, getSystemId, getValidationStatus, setConfiguration, setFixupStatus, setLineNumber, setLocator, setSystemId, setValidationStatus
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.saxonica.schema.ComponentReference
getConfiguration
 
Methods inherited from interface javax.xml.transform.SourceLocator
getColumnNumber, getLineNumber, getPublicId, getSystemId
 
Methods inherited from interface net.sf.saxon.type.SchemaComponent
getValidationStatus
 

Constructor Detail

AttributeGroupReference

public AttributeGroupReference(PreparedSchema schema,
                               int fingerprint)
Creates a new AttributeGroup reference

Parameters:
schema - the Schema that this AttributeGroup belongs to.
fingerprint - The NamePool fingerprint of the name of the attribute group (that is, the name contained in the 'ref' attribute)
Method Detail

isResolved

public boolean isResolved()
Determine whether this reference has been resolved

Specified by:
isResolved in interface ComponentReference

getSymbolSpace

public int getSymbolSpace()
Get the symbol space of the target of this reference

Specified by:
getSymbolSpace in interface ComponentReference

setFingerprint

public void setFingerprint(int fingerprint)
Set the fingerprint of the target of this reference


getFingerprint

public int getFingerprint()
Get the fingerprint of the target of this reference

Specified by:
getFingerprint in interface ComponentReference

getAttributeWildcard

public AttributeWildcard getAttributeWildcard(SchemaCompiler compiler)
                                       throws UnresolvedReferenceException
Returns the attribute wildcard in the referenced attribute group, if any.

Parameters:
compiler - May be null if used at validation time.
Returns:
the the attribute wildcard (xs:anyAttribute element) in the referenced attribute group, if there is one; otherwise null.
Throws:
UnresolvedReferenceException

fixup

public boolean fixup(SchemaCompiler compiler)
              throws SchemaException
Fix up references to other elements in the schema.

Specified by:
fixup in interface UserSchemaComponent
Parameters:
compiler -
Returns:
true (this implementation does nothing).
Throws:
SchemaException

validate

public boolean validate(SchemaCompiler compiler)
                 throws SchemaException
Checks the validity of this Schema component. For internal use only.

Specified by:
validate in interface UserSchemaComponent
Parameters:
compiler -
Returns:
true when this Schema definition is valid, otherwise false.
Throws:
SchemaException - if the ErrorListener decides that an error is fatal.

lookForCycles

public void lookForCycles(Stack references,
                          SchemaCompiler compiler)
                   throws SchemaException
Check for cycles in the attribute group. For internal use only.

Specified by:
lookForCycles in interface UserSchemaComponent
Overrides:
lookForCycles in class SchemaStructure
Parameters:
references - A list of attribute groups that reference this one, directly or indirectly.
compiler -
Throws:
SchemaException - if a circularity is detected.

tryToResolve

public void tryToResolve(SchemaCompiler compiler)
Attempt to resolve this reference using the groups defined in a given schema. No error results if the reference cannot be resolved.

Specified by:
tryToResolve in interface ComponentReference
Parameters:
compiler - The compiler being used to compile the referring component. This is assumed to know about the schema containing the candidate target components for the reference. If null, the schema containing the reference is used.

getTarget

public SchemaComponent getTarget()
Resolves the attribute group reference Note this method doesn't bind irrevocably to the target attribute group declaration, because this may change following a redefine.

Specified by:
getTarget in interface ComponentReference
Returns:
the schema component if the reference has been resolved.
Throws:
UnresolvedReferenceException - if the reference has not been resolved. Note that this is an unchecked exception.

serialize

public void serialize(SchemaSerializer serializer)
               throws IOException
Serialize the schema component

Specified by:
serialize in interface SerializableSchemaComponent
Throws:
IOException

getComponentTypeCode

public int getComponentTypeCode()
Get a unique number identifying the type of component

Specified by:
getComponentTypeCode in interface SerializableSchemaComponent


Copyright (C) Michael H. Kay. All rights reserved.