Package com.saxonica.ee.schema
Class AttributeGroupReference
- java.lang.Object
-
- com.saxonica.ee.schema.SchemaStructure
-
- com.saxonica.ee.schema.AttributeGroupReference
-
- All Implemented Interfaces:
ComponentReference
,javax.xml.transform.SourceLocator
,Location
,org.xml.sax.Locator
public final class AttributeGroupReference extends SchemaStructure implements ComponentReference
An XML Schema Attribute Group Reference, corresponding to an xs:attributeGroup element with a 'ref' attribute.
-
-
Constructor Summary
Constructors Constructor Description AttributeGroupReference(EnterpriseConfiguration config, StructuredQName target)
Creates a new AttributeGroup reference
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.boolean
fixup(SchemaCompiler compiler)
Fix up references to other elements in the schema.protected AttributeWildcard
getAttributeWildcard(SchemaCompiler compiler, java.util.Stack<AttributeGroupDecl> stack)
Returns the attribute wildcard in the referenced attribute group, if any.int
getSymbolSpace()
Get the symbol space of the target of this referenceSchemaComponent
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.StructuredQName
getTargetComponentName()
Get the name of the target of this referenceboolean
isDangling()
Ask whether this is known to be a dangling referenceboolean
isResolved()
Determine whether this reference has been resolvedvoid
lookForCycles(java.util.Stack references, SchemaCompiler compiler)
Check for cycles in the attribute group.void
setTargetComponentName(StructuredQName target)
Set the fingerprint of the target of this referencevoid
tryToResolve(SchemaCompiler compiler, boolean fatal)
Try to resolve the reference if possible, relative to components present in a given schema.boolean
validate(SchemaCompiler compiler)
Checks the validity of this Schema component.-
Methods inherited from class com.saxonica.ee.schema.SchemaStructure
getColumnNumber, getConfiguration, getFixupStatus, getGeneratedId, getLineNumber, getPublicId, getRedefinitionLevel, getSchemaDocumentURI, getSystemId, getValidationStatus, hasSameLocation, isValidationNeeded, makeXPathExpressionPropertyRecord, saveLocation, setConfiguration, setFixupStatus, setGeneratedId, setLineNumber, setLocator, setRedefinitionLevel, setSchemaDocumentURI, 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.ee.schema.ComponentReference
getConfiguration
-
Methods inherited from interface net.sf.saxon.s9api.Location
getColumnNumber, getLineNumber, getPublicId, getSystemId, saveLocation
-
-
-
-
Constructor Detail
-
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 Detail
-
isResolved
public boolean isResolved()
Determine whether this reference has been resolved- Specified by:
isResolved
in interfaceComponentReference
- 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 interfaceComponentReference
- 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 interfaceComponentReference
- 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 the name of the referenced attribute group
-
getTargetComponentName
public StructuredQName getTargetComponentName()
Get the name of the target of this reference- Specified by:
getTargetComponentName
in interfaceComponentReference
- Returns:
- the component name
-
getAttributeWildcard
protected AttributeWildcard getAttributeWildcard(SchemaCompiler compiler, java.util.Stack<AttributeGroupDecl> stack)
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:
MissingComponentException
- if the reference to the attribute group declaration cannot be resolved
-
fixup
public boolean fixup(SchemaCompiler compiler) throws SchemaException
Fix up references to other elements in the schema.- Overrides:
fixup
in classSchemaStructure
- 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.- Parameters:
compiler
- the schema compiler- Returns:
- true when this Schema definition is valid, otherwise false.
- Throws:
SchemaException
-
lookForCycles
public void lookForCycles(java.util.Stack references, SchemaCompiler compiler) throws SchemaException
Check for cycles in the attribute group. For internal use only.- Overrides:
lookForCycles
in classSchemaStructure
- 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 interfaceComponentReference
- Parameters:
compiler
- The compiler being used to compile the referring component.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 interfaceComponentReference
- 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.- Overrides:
elaborate
in classSchemaStructure
- Parameters:
compiler
- the schema compiler
-
-