Class TextFragmentValue

  • All Implemented Interfaces:
    NodeList

    public final class TextFragmentValue
    extends SingletonNodeSet
    This class represents a Value of type result tree fragment, specifically, an RTF whose root owns a single text node.
    • Constructor Detail

      • TextFragmentValue

        public TextFragmentValue​(String value,
                                 String systemId,
                                 Controller controller)
        Constructor: create a result tree fragment containing a single text node
        Parameters:
        value - : a String containing the value
    • Method Detail

      • asString

        public String asString()
        Convert the result tree fragment to a string.
        Overrides:
        asString in class SingletonNodeSet
        Returns:
        the value of the first node in the node-set if there is one, otherwise an empty string
      • asNumber

        public double asNumber()
        Convert the result tree fragment to a number
        Overrides:
        asNumber in class NodeSetValue
        Returns:
        the number obtained by evaluating as a String and converting the string to a number
      • asBoolean

        public boolean asBoolean()
        Convert the result tree fragment to a boolean
        Overrides:
        asBoolean in class SingletonNodeSet
        Returns:
        true if the node set is not empty
      • getFirst

        public NodeInfo getFirst()
        Get the first node in the nodeset (in document order)
        Overrides:
        getFirst in class SingletonNodeSet
        Returns:
        the first node
      • compare

        public boolean compare​(int operator,
                               Value other)
                        throws XPathException
        Test how a FragmentValue compares to another Value under a relational comparison.
        Overrides:
        compare in class NodeSetValue
        Parameters:
        operator - The comparison operator, one of Tokenizer.LE, Tokenizer.LT, Tokenizer.GE, Tokenizer.GT,
        Throws:
        XPathException
      • getType

        public int getType()
        Return the type of the value
        Returns:
        Value.NODESET (always)
      • getDataType

        public int getDataType()
        Determine the data type of the expression, if possible
        Overrides:
        getDataType in class NodeSetValue
        Returns:
        Value.NODESET
      • getRootNode

        public DocumentInfo getRootNode()
        Get the root (document) node
      • display

        public void display​(int level)
        Diagnostic print of expression structure
        Overrides:
        display in class NodeSetValue