Package com.saxonica.ee.schema
Class IdentityConstraint
java.lang.Object
com.saxonica.ee.schema.SchemaStructure
com.saxonica.ee.schema.IdentityConstraint
- All Implemented Interfaces:
SerializableSchemaComponent
,UserSchemaComponent
,SourceLocator
,Location
,SchemaComponent
,Locator
public abstract class IdentityConstraint
extends SchemaStructure
implements UserSchemaComponent, SerializableSchemaComponent
The base class for the XML Schema Identity Constraints
(key, keyref, unique).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addField
(IdentityField field) Adds the given IdentityField to this IdentityConstraintvoid
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) Check references from this component to other componentsGet the schema component in the form of a function item.abstract String
The type of constraint: one of "key", "unique", or "keyref"Get the name of this identity constraintReturns the List of Fields contained within this IdentityConstraint.getName()
Return the name of this IdentityConstraint.Returns the selector of this IdentityConstraint.Return the target namespace of this IdentityConstraint.boolean
boolean
Test whether this is the same constraint as another.void
serialize
(SchemaModelSerializer serializer) Serialize the identity constraint as part of the serialized Schema Component Modelvoid
Set the integer cdde of the name of this identity constraintvoid
setOrdered
(boolean ordered) void
setSelector
(IdentitySelector selector) Sets the selector for this IdentityConstraint.void
typeCheck
(SchemaCompiler compiler, SchemaType contextType) Typecheck the selector and the fields.boolean
validate
(SchemaCompiler compiler) Checks the validity of this Schema definition.Methods inherited from class com.saxonica.ee.schema.SchemaStructure
getColumnNumber, getConfiguration, getFixupStatus, getGeneratedId, getLineNumber, getPublicId, getRedefinitionLevel, getSchemaDocumentURI, getSystemId, getValidationStatus, hasSameLocation, isValidationNeeded, lookForCycles, 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 net.sf.saxon.type.SchemaComponent
getRedefinitionLevel, getValidationStatus
Methods inherited from interface com.saxonica.ee.schema.UserSchemaComponent
lookForCycles
-
Constructor Details
-
IdentityConstraint
protected IdentityConstraint()Constructor used by sub-classes. Creates a new IdentityConstraint.
-
-
Method Details
-
getConstraintCategory
The type of constraint: one of "key", "unique", or "keyref"- Returns:
- one of "key", "unique", or "keyref" (note the spelling)
-
addField
Adds the given IdentityField to this IdentityConstraint- Parameters:
field
- the IdentityField to add.
-
getFields
Returns the List of Fields contained within this IdentityConstraint.- Returns:
- the List of fields
-
getName
Return the name of this IdentityConstraint. This value will never be null.- Returns:
- the name of this IdentityConstraint
-
getTargetNamespace
Return the target namespace of this IdentityConstraint.- Returns:
- the target namespace of this IdentityConstraint. Return null if the target namespace is "absent".
-
getSelector
Returns the selector of this IdentityConstraint.- Returns:
- the IdentitySelector of this IdentityConstraint
-
setSelector
Sets the selector for this IdentityConstraint.- Parameters:
selector
- the Selector for this IdentityConstraint. Must not be null.
-
setConstraintName
Set the integer cdde of the name of this identity constraint- Parameters:
nc
- the namecode
-
getConstraintName
Get the name of this identity constraint- Returns:
- the component's name
-
setOrdered
public void setOrdered(boolean ordered) -
isOrdered
public boolean isOrdered() -
fixup
Check references from this component to other components- Specified by:
fixup
in interfaceUserSchemaComponent
- Overrides:
fixup
in classSchemaStructure
- Parameters:
compiler
- the schema compiler- Returns:
- true if all is well, false if errors found
- Throws:
SchemaException
-
validate
Checks the validity of this Schema definition.- 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 definition is invalid
-
typeCheck
Typecheck the selector and the fields. This reports warnings if the XPath expressions used in defining the constraint cannot select anything, or under similar conditions- Parameters:
compiler
- the schema compilercontextType
- the type of the element whose constraint is being defined- Throws:
XPathException
- if a type error is found
-
isSameDeclaration
Test whether this is the same constraint as another. They are considered to be the same component if they are derived from the same definition in the original XML representation (which can happen when there are multiple includes of the same file)- Parameters:
other
- the notation declaration that we are comparing with- Returns:
- true if the two notation declarations are identical
-
elaborate
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
-
serialize
Serialize the identity constraint as part of the serialized Schema Component Model- Specified by:
serialize
in interfaceSerializableSchemaComponent
- Parameters:
serializer
- the object responsible for performing the serialization- Throws:
XPathException
- if serialization fails
-
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.
-