Package com.icl.saxon.expr
Class TextFragmentValue
java.lang.Object
com.icl.saxon.expr.Expression
com.icl.saxon.expr.Value
com.icl.saxon.expr.NodeSetValue
com.icl.saxon.expr.SingletonNodeSet
com.icl.saxon.expr.TextFragmentValue
- All Implemented Interfaces:
NodeList
This class represents a Value of type result tree fragment, specifically,
an RTF whose root owns a single text node.
-
Field Summary
Fields inherited from class com.icl.saxon.expr.SingletonNodeSet
generalUseAllowed, node
Fields inherited from class com.icl.saxon.expr.Expression
staticContext
-
Constructor Summary
ConstructorsConstructorDescriptionTextFragmentValue
(String value, String systemId, Controller controller) Constructor: create a result tree fragment containing a single text node -
Method Summary
Modifier and TypeMethodDescriptionboolean
Convert the result tree fragment to a booleandouble
asNumber()
Convert the result tree fragment to a numberasString()
Convert the result tree fragment to a string.boolean
Test how a FragmentValue compares to another Value under a relational comparison.void
Copy the result tree fragment value to a given Outputtervoid
display
(int level) Diagnostic print of expression structureReturn an enumeration of this nodeset value.boolean
Test whether a nodeset "equals" another Valueint
getCount()
Count the nodes in the node-set.int
Determine the data type of the expression, if possiblegetFirst()
Get the first node in the nodeset (in document order)Get the root (document) nodeint
getType()
Return the type of the valueboolean
Test whether a nodeset "not-equals" another Valuevoid
outputStringValue
(Outputter out, Context context) Evaluate an expression as a String and write the result to the specified outputter.simplify()
Simplify the expressionMethods inherited from class com.icl.saxon.expr.SingletonNodeSet
allowGeneralUse, evaluate, evaluateAsNodeSet, getLength, isGeneralUseAllowed, isSorted, item, setSorted, sort
Methods inherited from class com.icl.saxon.expr.NodeSetValue
conversionPreference, convertToJava, enumerate
Methods inherited from class com.icl.saxon.expr.Value
getDependencies, inverse, numericCompare, reduce, stringToNumber
Methods inherited from class com.icl.saxon.expr.Expression
containsReferences, evaluateAsBoolean, evaluateAsNumber, evaluateAsString, getStaticContext, indent, isContextDocumentNodeSet, make, setStaticContext, usesCurrent
-
Constructor Details
-
TextFragmentValue
Constructor: create a result tree fragment containing a single text node- Parameters:
value
- : a String containing the value
-
-
Method Details
-
asString
Convert the result tree fragment to a string.- Overrides:
asString
in classSingletonNodeSet
- Returns:
- the value of the first node in the node-set if there is one, otherwise an empty string
-
outputStringValue
Evaluate an expression as a String and write the result to the specified outputter.- Overrides:
outputStringValue
in classExpression
- Parameters:
out
- The required outputtercontext
- The context in which the expression is to be evaluated- Throws:
TransformerException
-
asNumber
public double asNumber()Convert the result tree fragment to a number- Overrides:
asNumber
in classNodeSetValue
- 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 classSingletonNodeSet
- Returns:
- true if the node set is not empty
-
getCount
public int getCount()Count the nodes in the node-set.- Overrides:
getCount
in classSingletonNodeSet
-
simplify
Simplify the expression- Overrides:
simplify
in classSingletonNodeSet
- Returns:
- the simplified expression
-
getFirst
Get the first node in the nodeset (in document order)- Overrides:
getFirst
in classSingletonNodeSet
- Returns:
- the first node
-
enumerate
Return an enumeration of this nodeset value.- Overrides:
enumerate
in classSingletonNodeSet
- Throws:
XPathException
-
equals
Test whether a nodeset "equals" another Value- Overrides:
equals
in classSingletonNodeSet
- Returns:
- a boolean giving the value of the expression, evaluated in the current context
- Throws:
XPathException
-
notEquals
Test whether a nodeset "not-equals" another Value- Overrides:
notEquals
in classSingletonNodeSet
- Returns:
- a boolean giving the value of the expression, evaluated in the current context
- Throws:
XPathException
-
compare
Test how a FragmentValue compares to another Value under a relational comparison.- Overrides:
compare
in classNodeSetValue
- 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 classNodeSetValue
- Returns:
- Value.NODESET
-
getRootNode
Get the root (document) node -
copy
Copy the result tree fragment value to a given Outputter- Throws:
TransformerException
-
display
public void display(int level) Diagnostic print of expression structure- Overrides:
display
in classNodeSetValue
-