Class JNode

java.lang.Object
net.sf.saxon.ma.jnode.JNode
All Implemented Interfaces:
GNode, GroundedValue, Item, Sequence
Direct Known Subclasses:
ChildJNode, RootJNode

public abstract class JNode extends Object implements GNode
Abstract implementation of JNode, covering both root and non-root JNodes
  • Constructor Details

    • JNode

      public JNode()
  • Method Details

    • getContent

      public abstract GroundedValue getContent()
      Get the value of the content property
      Returns:
      the content of the JNode
    • hasChildNodes

      public boolean hasChildNodes()
      Ask whether the JNode has any children
      Specified by:
      hasChildNodes in interface GNode
      Returns:
      true if there are children: that is, if the content includes an array or map
    • getPosition

      public abstract int getPosition()
      Get the value of the position property
      Returns:
      the position
    • getSelector

      public abstract AtomicValue getSelector()
      Get the value of the selector property
      Returns:
      the selector. Returns null if the property is absent (for a root JNode)
    • getParent

      public abstract JNode getParent()
      Get the parent of this JNode
      Specified by:
      getParent in interface GNode
      Returns:
      the value of the parent property
    • getRoot

      public RootJNode getRoot()
      Get the root of this JTree
      Returns:
      the root of the tree
    • getNodeKind

      public int getNodeKind()
      Get the node kind
      Specified by:
      getNodeKind in interface GNode
      Returns:
      Type.JNODE
    • getGenre

      public Genre getGenre()
      Get the genre of this item (to distinguish the top-level categories of item, such as nodes, atomic values, and functions)
      Specified by:
      getGenre in interface Item
      Returns:
      the genre
    • getUnicodeStringValue

      public UnicodeString getUnicodeStringValue()
      Get the value of the item as a Unicode string. For nodes, this is the string value of the node as defined in the XPath 2.0 data model, except that all nodes are treated as being untyped: it is not an error to get the string value of a node with a complex type. For atomic values, the method returns the result of casting the atomic value to a string.
      Specified by:
      getUnicodeStringValue in interface GroundedValue
      Specified by:
      getUnicodeStringValue in interface Item
      Returns:
      the string value of the item
      Throws:
      UnsupportedOperationException - if the item is a function item (an unchecked exception is used here to avoid introducing exception handling to a large number of paths where it is not needed)
      Since:
      8.4
    • atomize

      public AtomicSequence atomize() throws XPathException
      Atomize the item.
      Specified by:
      atomize in interface Item
      Returns:
      the result of atomization
      Throws:
      XPathException - if atomization is not allowed for this kind of item
    • toString

      public String toString()
      Returns a string representation of the object.
      Overrides:
      toString in class Object
    • toShortString

      public String toShortString()
      Description copied from interface: Item
      Provide a short string showing the contents of the item, suitable for use in error messages
      Specified by:
      toShortString in interface GroundedValue
      Specified by:
      toShortString in interface Item
      Returns:
      a depiction of the item suitable for use in error messages