Package com.saxonica.ee.validate
Class SchemaAttributeType
java.lang.Object
net.sf.saxon.type.gnode.GNodeType
net.sf.saxon.type.gnode.XNodeType
com.saxonica.ee.validate.SchemaAttributeType
- All Implemented Interfaces:
NamedXNodePredicate,NodePredicate,NodeTest,SchemaNodeTest,ItemType,ItemTypeWithSequenceTypeCache
A Node type of the form schema-attribute(attribute-name)
- Since:
- 9.3
-
Constructor Summary
ConstructorsConstructorDescriptionSchemaAttributeType(PreparedSchema schema, AttributeDecl attributeDecl) Constructor -
Method Summary
Modifier and TypeMethodDescriptionbooleanexplainMismatch(Item item, TypeHierarchy th) Get extra diagnostic information about why a supplied item does not conform to this item type, if available.Get the set of allowed node names that this type is capable of matchingGet an alphabetic code representing the type, or at any rate, the nearest built-in type from which this type is derived.Get the allowed content type permitted by this item type.final doubleDetermine the default priority of this node test when used on its own as a PatternGet the corresponding StructuredQName: the name that all nodes must have if they are to satisfy the predicateintGet the kind of nodes that this node predicate matchesintDetermine the types of nodes to which this pattern applies.intGet a fingerprint that all nodes (of the specified node kind) must have if they are to satisfy the predicate.intgetRequiredFingerprint(int nodeKind) For anXNodeTypethat can only match one kind of node and one node name, return that node name, as an integer fingerprint.Get the schema from the static context of this type designationgetUType()Get the correspondingUType.inthashCode()Returns a hash code value for the object.booleanAsk whether having the required fingerprint and node kind is a sufficient condition for a node to satisfy the predicate, or whether other conditions (such as type annotation or nillability) must also be satisfied.booleanTest whether this node test is satisfied by a given node.toString()Methods inherited from class net.sf.saxon.type.gnode.XNodeType
asXNodeTest, getCoercionPlan, getGenre, isNillableMethods inherited from class net.sf.saxon.type.gnode.GNodeType
getAtomizedItemType, getItemType, getPrimitiveItemType, getQNameTest, isAtomicType, isAtomizable, isPlainType, one, oneOrMore, test, toShortString, zeroOrMore, zeroOrOneMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.sf.saxon.type.ItemType
asChoiceItemType, getNormalizedDefaultPriority, normalizeItemType, toExportString
-
Constructor Details
-
SchemaAttributeType
public SchemaAttributeType(PreparedSchema schema, AttributeDecl attributeDecl) throws MissingComponentException Constructor- Parameters:
schema- the relevant schemaattributeDecl- The attribute declaration of the named attribute- Throws:
MissingComponentException- if the type of the attribute is missing from the schema
-
-
Method Details
-
getSchema
Get the schema from the static context of this type designation- Returns:
- the in-scope schema
-
getContentType
Get the allowed content type permitted by this item type.- Overrides:
getContentTypein classXNodeType- Returns:
- the allowed content type
-
getAllowedNodeNames
Get the set of allowed node names that this type is capable of matching- Specified by:
getAllowedNodeNamesin classXNodeType- Returns:
- the allowed node names
-
getNodeName
- Specified by:
getNodeNamein interfaceSchemaNodeTest
-
getRequiredFingerprint
public int getRequiredFingerprint(int nodeKind) For anXNodeTypethat can only match one kind of node and one node name, return that node name, as an integer fingerprint. In other cases, return -1.- Overrides:
getRequiredFingerprintin classXNodeType- Parameters:
nodeKind- the kind of node required. If theXNodeTypedoes not match this node kind, return -1.- Returns:
- an integer fingerprint in the case of a node type that only matches one node kind and one qualified name. In other cases return -1.
-
getUType
Get the correspondingUType. A UType is a union of primitive item types. -
getNodeKind
public int getNodeKind()Get the kind of nodes that this node predicate matches- Specified by:
getNodeKindin interfaceNamedXNodePredicate- Returns:
- the kind of nodes specifically
Type.ATTRIBUTE
-
getRequiredFingerprint
public int getRequiredFingerprint()Get a fingerprint that all nodes (of the specified node kind) must have if they are to satisfy the predicate.- Specified by:
getRequiredFingerprintin interfaceNamedXNodePredicate- Returns:
- the fingerprint of the name that a node must have if it is to satisfy the predicate
-
getMatchingNodeName
Get the corresponding StructuredQName: the name that all nodes must have if they are to satisfy the predicate- Specified by:
getMatchingNodeNamein interfaceNamedXNodePredicate- Returns:
- the name that a node must have if it is to satisfy the predicate
-
isFingerprintSufficient
public boolean isFingerprintSufficient()Ask whether having the required fingerprint and node kind is a sufficient condition for a node to satisfy the predicate, or whether other conditions (such as type annotation or nillability) must also be satisfied.- Specified by:
isFingerprintSufficientin interfaceNamedXNodePredicate- Returns:
- true if matching the fingerprint is a sufficient condition.
-
matches
Test whether this node test is satisfied by a given node. This alternative method is used in the case of nodes where calculating the fingerprint is expensive, for example DOM or JDOM nodes. -
getDefaultPriority
public final double getDefaultPriority()Determine the default priority of this node test when used on its own as a Pattern- Specified by:
getDefaultPriorityin interfaceItemType- Specified by:
getDefaultPriorityin interfaceNodeTest- Returns:
- the default priority
-
getPrimitiveType
public int getPrimitiveType()Determine the types of nodes to which this pattern applies. Used for optimisation. For patterns that match nodes of several types, return Type.NODE- Specified by:
getPrimitiveTypein interfaceItemType- Overrides:
getPrimitiveTypein classGNodeType- Returns:
- the type of node matched by this pattern. e.g. Type.ELEMENT or Type.TEXT
-
toString
-
hashCode
public int hashCode()Returns a hash code value for the object. -
equals
-
getBasicAlphaCode
Description copied from interface:ItemTypeGet an alphabetic code representing the type, or at any rate, the nearest built-in type from which this type is derived. The codes are designed so that for any two built-in types A and B, alphaCode(A) is a prefix of alphaCode(B) if and only if A is a supertype of B.- Specified by:
getBasicAlphaCodein interfaceItemType- Returns:
- the alphacode for the nearest containing built-in type. For example: for xs:string return "AS", for xs:boolean "AB", for node() "N", for element() "NE", for map(*) "FM", for array(*) "FA".
-
explainMismatch
Get extra diagnostic information about why a supplied item does not conform to this item type, if available. If extra information is returned, it should be in the form of a complete sentence, minus the closing full stop. No information should be returned for obvious cases.- Specified by:
explainMismatchin interfaceItemType- Specified by:
explainMismatchin interfaceNodeTest- Overrides:
explainMismatchin classGNodeType- Parameters:
item- the item that doesn't match this typeth- the type hierarchy cache- Returns:
- optionally, a message explaining why the item does not match the type
-