Class XNodeType

java.lang.Object
net.sf.saxon.type.gnode.GNodeType
net.sf.saxon.type.gnode.XNodeType
All Implemented Interfaces:
NodePredicate, NodeTest, ItemType, ItemTypeWithSequenceTypeCache
Direct Known Subclasses:
AnyXNodeType, DocumentNodeType, NamedXNodeType, NodeKindType, PortableNamedXNodeType

public abstract class XNodeType extends GNodeType
Abstract superclass for all item types that match XNodes only. There are several subtypes:
  • Constructor Details

    • XNodeType

      public XNodeType()
  • Method Details

    • getGenre

      public Genre getGenre()
      Determine the Genre (top-level classification) of this type
      Specified by:
      getGenre in interface ItemType
      Overrides:
      getGenre in class GNodeType
      Returns:
      the Genre to which this type belongs, for example node or atomic value
    • asXNodeTest

      public NodeTest asXNodeTest(Configuration config)
      Description copied from interface: NodeTest
      Get an XNodeTest that will match any XNode that this NodeTest matches: that is, eliminate the possibility of matching a JNode.
    • getAllowedNodeNames

      public abstract QNameTest getAllowedNodeNames()
      Get the set of allowed node names that this type if capable of matching
      Returns:
      the allowed node names
    • getRequiredFingerprint

      public int getRequiredFingerprint(int nodeKind)
      For an XNodeType that can only match one kind of node and one node name, return that node name, as an integer fingerprint. In other cases, return -1.
      Parameters:
      nodeKind - the kind of node required. If the XNodeType does 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

      public UType getUType()
      Get the corresponding UType. A UType is a union of primitive item types.
      Specified by:
      getUType in interface ItemType
      Specified by:
      getUType in interface NodeTest
      Overrides:
      getUType in class GNodeType
      Returns:
      the smallest UType that subsumes this item type
    • getContentType

      public SchemaType getContentType()
      Get the allowed content type permitted by this item type. Defaults to allowing any content
      Overrides:
      getContentType in class GNodeType
      Returns:
      the allowed content type
    • isNillable

      public boolean isNillable()
      Ask whether nodes that are nilled can match this type. Defaults to true
      Returns:
      true if the content test (when present) can match nodes that are nilled
    • getCoercionPlan

      public CoercionPlan getCoercionPlan(int version)
      Get the coercion plan for use when this type is the required type for (say) coercion of arguments in a function call
      Specified by:
      getCoercionPlan in interface ItemType
      Overrides:
      getCoercionPlan in class GNodeType
      Parameters:
      version - the XPath language version (40 or 31)