Package com.saxonica.ee.validate
Class SchemaElementType
java.lang.Object
net.sf.saxon.type.gnode.GNodeType
net.sf.saxon.type.gnode.XNodeType
com.saxonica.ee.validate.SchemaElementType
- All Implemented Interfaces:
NodePredicate,NodeTest,SchemaNodeTest,ItemType,ItemTypeWithSequenceTypeCache
A Node type of the form schema-element(element-name)
- Since:
- 9.3
-
Constructor Summary
Constructors -
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 if 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 content type allowed by this NodeTest (that is, the type annotation of the matched nodes).final doubleDetermine the default priority of this node test when used on its own as a PatternGet the element declarationintGet the fingerprint of the head of the substitution groupintDetermine the types of nodes to which this pattern applies.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.booleanDetermine whether nilled nodes can match this node testbooleanisNillable(int fingerprint) Determine if nilled nodes named N can match this node testbooleanTest whether this node test is satisfied by a given node.static booleanmatchesAnnotation(SchemaType required, SchemaType actual, TypeHierarchy th) Determine whether the type annotation of an element or attribute instances matches the required type of the element or attribute declaration named in a schema-element() or schema-attribute() testtoString()Methods inherited from class net.sf.saxon.type.gnode.XNodeType
asXNodeTest, getCoercionPlan, getGenreMethods 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
-
SchemaElementType
public SchemaElementType(PreparedSchema schema, ElementDecl element) throws MissingComponentException Constructor- Parameters:
element- The element declaration of the named element- Throws:
MissingComponentException
-
-
Method Details
-
getAllowedNodeNames
Get the set of allowed node names that this type if capable of matching- Specified by:
getAllowedNodeNamesin classXNodeType- Returns:
- the allowed node names
-
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.
-
getElementDeclaration
Get the element declaration- Returns:
- the element declaration that this schema-element relates to (the head of the substitution group)
-
getSchema
Get the schema from the static context of this type designation- Returns:
- the in-scope schema
-
getNodeName
- Specified by:
getNodeNamein interfaceSchemaNodeTest
-
getUType
Get the correspondingUType. A UType is a union of primitive item types. -
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. -
matchesAnnotation
Determine whether the type annotation of an element or attribute instances matches the required type of the element or attribute declaration named in a schema-element() or schema-attribute() test- Parameters:
required- the required type of the declaration named in the schema-element() or schema-attribute testactual- the actual type annotation of the instanceth- the type hierarchy cache- Returns:
- true if there is a match, false otherwise
-
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
-
getContentType
Get the content type allowed by this NodeTest (that is, the type annotation of the matched nodes). Return AnyType if there are no restrictions. The default implementation returns AnyType.- Overrides:
getContentTypein classXNodeType- Returns:
- the allowed content type
-
isNillable
public boolean isNillable()Determine whether nilled nodes can match this node test- Specified by:
isNillablein interfaceNodeTest- Overrides:
isNillablein classXNodeType- Returns:
- true if nilled nodes can match this node test
-
isNillable
public boolean isNillable(int fingerprint) Determine if nilled nodes named N can match this node test- Parameters:
fingerprint- the element name- Returns:
- true if nilled nodes with the given name can match the node test
-
getHeadFingerprint
public int getHeadFingerprint()Get the fingerprint of the head of the substitution group- Returns:
- the fingerprint of the head of the substitution group
-
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
-