Class AttributeGroupReference

java.lang.Object
com.saxonica.ee.schema.SchemaStructure
com.saxonica.ee.schema.AttributeGroupReference
All Implemented Interfaces:
ComponentReference, UserSchemaComponent, SourceLocator, Location, SchemaComponent, Locator

public final class AttributeGroupReference extends SchemaStructure implements ComponentReference, SchemaComponent
An XML Schema Attribute Group Reference, corresponding to an xs:attributeGroup element with a 'ref' attribute.
  • Constructor Details

    • AttributeGroupReference

      public AttributeGroupReference(EnterpriseConfiguration config, StructuredQName target)
      Creates a new AttributeGroup reference
      Parameters:
      config - the Configuration that this AttributeGroup belongs to.
      target - The name of the referenced attribute group (that is, the name contained in the 'ref' attribute)
  • Method Details

    • isResolved

      public boolean isResolved()
      Determine whether this reference has been resolved
      Specified by:
      isResolved in interface ComponentReference
      Returns:
      true if the reference has been resolved to a schema component
    • isDangling

      public boolean isDangling()
      Ask whether this is known to be a dangling reference
      Specified by:
      isDangling in interface ComponentReference
      Returns:
      true if the target of this component reference is known to be absent, and if a warning has been issued to this effect
    • getSymbolSpace

      public int getSymbolSpace()
      Get the symbol space of the target of this reference
      Specified by:
      getSymbolSpace in interface ComponentReference
      Returns:
      an integer code identifying the symbol space
    • setTargetComponentName

      public void setTargetComponentName(StructuredQName target)
      Set the fingerprint of the target of this reference
      Parameters:
      target - the name of the referenced attribute group
    • getTargetComponentName

      public StructuredQName getTargetComponentName()
      Get the name of the target of this reference
      Specified by:
      getTargetComponentName in interface ComponentReference
      Returns:
      the component name
    • fixup

      public boolean fixup(SchemaCompiler compiler) throws SchemaException
      Fix up references to other elements in the schema.
      Specified by:
      fixup in interface UserSchemaComponent
      Overrides:
      fixup in class SchemaStructure
      Parameters:
      compiler - the schema compiler
      Returns:
      true if fixup succeeds, false if it fails.
      Throws:
      SchemaException - if a fatal error occurs
    • 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
      Overrides:
      validate in class SchemaStructure
      Parameters:
      compiler - the schema 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<SchemaComponent> 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 - the schema compiler
      Throws:
      SchemaException - if a circularity is detected.
    • tryToResolve

      public void tryToResolve(SchemaCompiler compiler, boolean fatal) throws SchemaException
      Try to resolve the reference if possible, relative to components present in a given schema. If the reference cannot be resolved, the action depends on whether the compiler service allows dangling references to absent components. If it does, we try to patch the schema up with a dummy component (where possible). If not, the method throws an exception
      Specified by:
      tryToResolve in interface ComponentReference
      Parameters:
      compiler - The compiler being used to compile the referring component.
      fatal - true if a failure to resolve is to be treated as fatal
      Throws:
      SchemaException - if the reference cannot be resolved or repaired.
    • getTarget

      public SchemaComponent getTarget() throws MissingComponentException
      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:
      MissingComponentException - if the reference has not been resolved.
    • elaborate

      public void elaborate(SchemaCompiler compiler)
      Elaborate the schema component: after reloading a serialized schema component model, this expands the component with derived information needed during validation episodes. The model is assumed to be valid.
      Specified by:
      elaborate in interface UserSchemaComponent
      Overrides:
      elaborate in class SchemaStructure
      Parameters:
      compiler - the schema compiler
    • getComponentAsFunction

      public FunctionItem getComponentAsFunction()
      Description copied from interface: SchemaComponent
      Get the schema component in the form of a function item. This allows schema information to be made visible to XSLT or XQuery code. The function makes available the contents of the schema component as defined in the XSD specification. The function takes a string as argument representing a property name, and returns the corresponding property of the schema component. There is also a property "class" which returns the kind of schema component, for example "Attribute Declaration".
      Specified by:
      getComponentAsFunction in interface SchemaComponent
      Overrides:
      getComponentAsFunction in class SchemaStructure
      Returns:
      the schema component represented as a function from property names to property values.