Package com.saxonica.ee.schema
Class AttributeGroupReference
- java.lang.Object
-
- com.saxonica.ee.schema.SchemaStructure
-
- com.saxonica.ee.schema.AttributeGroupReference
-
- All Implemented Interfaces:
ComponentReference
,UserSchemaComponent
,javax.xml.transform.SourceLocator
,Location
,SchemaComponent
,org.xml.sax.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 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.Function
getComponentAsFunction()
Get the schema component in the form of a function item.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<SchemaComponent> 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
-
Methods inherited from interface net.sf.saxon.type.SchemaComponent
getRedefinitionLevel, getValidationStatus
-
-
-
-
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
-
fixup
public boolean fixup(SchemaCompiler compiler) throws SchemaException
Fix up references to other elements in the schema.- Specified by:
fixup
in interfaceUserSchemaComponent
- 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.- Specified by:
validate
in interfaceUserSchemaComponent
- Overrides:
validate
in classSchemaStructure
- 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(java.util.Stack<SchemaComponent> references, SchemaCompiler compiler) throws SchemaException
Check for cycles in the attribute group. For internal use only.- Specified by:
lookForCycles
in interfaceUserSchemaComponent
- 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
- 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 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.- Specified by:
elaborate
in interfaceUserSchemaComponent
- Overrides:
elaborate
in classSchemaStructure
- Parameters:
compiler
- the schema compiler
-
getComponentAsFunction
public Function 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 interfaceSchemaComponent
- Overrides:
getComponentAsFunction
in classSchemaStructure
- Returns:
- the schema component represented as a function from property names to property values.
-
-