net.sf.saxon.value
public abstract class Value extends Object implements Expression, Serializable, ValueRepresentation
Field Summary | |
---|---|
static Class[] | EMPTY_CLASS_ARRAY |
Method Summary | |
---|---|
static Item | asItem(ValueRepresentation value)
Static method to make an Item from a Value |
static SequenceIterator | asIterator(ValueRepresentation val, XPathContext context)
Static method to get an Iterator over any ValueRepresentation (which may be either a Value
or a NodeInfo |
static Value | asValue(ValueRepresentation val)
Static method to make a Value from a given Item (which may be either an AtomicValue
or a NodeInfo |
void | checkPermittedContents(SchemaType parentType, StaticContext env, boolean whole)
Check statically that the results of the expression are capable of constructing the content
of a given schema type. |
static CharSequence | collapseWhitespace(CharSequence in)
Collapse whitespace as defined in XML Schema |
static Object | convert(Item item)
Internal method to convert an XPath value to a Java object.
|
static Value | convertJavaObjectToXPath(Object object, SequenceType requiredType, Configuration config)
Convert a Java object to an XPath value. |
Object | convertToJava(Class target, XPathContext context)
Convert to Java object (for passing to external functions) |
void | display(int level, NamePool pool, PrintStream out)
Diagnostic display of the expression |
boolean | effectiveBooleanValue(XPathContext context)
Get the effective boolean value of the expression. |
boolean | equals(Object obj)
Compare two (sequence) values for equality. |
String | evaluateAsString(XPathContext context)
Evaluate an expression as a String. |
Item | evaluateItem(XPathContext context)
Evaluate as a singleton item (or empty sequence). |
int | getCardinality()
Determine the cardinality |
int | getDependencies()
Determine which aspects of the context the expression depends on. |
ItemType | getItemType(TypeHierarchy th)
Determine the data type of the items in the expression, if possible |
static SequenceIterator | getIterator(ValueRepresentation val)
Get a SequenceIterator over a ValueRepresentation |
int | getLength()
Get the length of the sequence |
Container | getParentExpression()
Get the expression that immediately contains this expression. |
int | getSpecialProperties()
Get the static properties of this expression (other than its type). |
String | getStringValue()
Convert the value to a string, using the serialization rules.
|
int | hashCode()
Return a hash code to support the equals() function |
Item | itemAt(int n)
Get the n'th item in the sequence (starting from 0). |
Iterator | iterateSubExpressions()
Get the sub-expressions of this expression. |
static QNameValue | makeQNameValue(Object object, Configuration config)
Temporary method to make a QNameValue from a JAXP 1.3 QName, without creating a compile-time link
to the JDK 1.5 QName class |
static CharSequence | normalizeWhitespace(CharSequence in)
Normalize whitespace as defined in XML Schema |
Expression | optimize(Optimizer opt, StaticContext env, ItemType contextItemType)
Optimize an expression |
void | process(XPathContext context)
Process the value as an instruction, without returning any tail calls |
Expression | promote(PromotionOffer offer)
Offer promotion for this subexpression. |
Value | reduce()
Reduce a value to its simplest form. |
boolean | schemaEquals(Value obj)
Compare two (sequence) values for equality. |
Expression | simplify(StaticContext env)
Simplify an expression |
static double | stringToNumber(CharSequence s)
Static method to convert strings to numbers. |
String | toString()
Convert to a string for diagnostic output |
static CharSequence | trimWhitespace(CharSequence in)
Remove leading and trailing whitespace. |
Expression | typeCheck(StaticContext env, ItemType contextItemType)
TypeCheck an expression |
Parameters: value the value to be converted
Returns: null if the value is an empty sequence; or the only item in the value if it is a singleton sequence
Throws: XPathException if the Value contains multiple items
Parameters: val The supplied value, or null, indicating the empty sequence. context The evaluation context. This may be null. It should always be possible to iterate over a value without supplying a context, but sometimes the context can provide access to better error information
Returns: The supplied value, if it is a value, or a SingletonNode that wraps the item, if it is a node. If the supplied value was null, return an EmptySequence
Parameters: val The supplied value, or null, indicating the empty sequence.
Returns: The supplied value, if it is a value, or a SingletonNode that wraps the item, if it is a node. If the supplied value was null, return an EmptySequence
Parameters: parentType The schema type env the static context whole
Throws: XPathException if the expression doesn't match the required content type
Parameters: object The Java object to be converted requiredType The required type of the result (if known) config The Configuration: may be null, in which case certain kinds of object (eg. DOM nodes) cannot be handled
Returns: the result of converting the value. If the value is null, returns null.
Parameters: context The context in which the expression is to be evaluated
Returns: the effective boolean value
Throws: XPathException if any dynamic error occurs evaluating the expression
Parameters: context The context in which the expression is to be evaluated
Returns: the value of the expression, evaluated in the current context. The expression must return a string or (); if the value of the expression is (), this method returns "".
Throws: XPathException if any dynamic error occurs evaluating the expression ClassCastException if the result type of the expression is not xs:string?
Returns: for a Value, this always returns zero.
Parameters: th The TypeHierarchy. Can be null if the target is an AtomicValue.
Returns: for the default implementation: AnyItemType (not known)
Returns: the expression that contains this expression, if known; return null if there is no containing expression or if the containing expression is unknown.
Returns: NON_CREATIVE
Throws: XPathException The method can fail if evaluation of the value has been deferred, and if a failure occurs during the deferred evaluation. No failure is possible in the case of an AtomicValue.
Returns: for a Value, this always returns an empty array
Parameters: object an instance of javax.xml.namespace.QName
Returns: a corresponding Saxon QNameValue, or null if any error occurs performing the conversion
Returns: for a Value, this always returns the value unchanged
Parameters: context The dynamic context, giving access to the current node, the current variables, etc.
Parameters: offer details of the offer, for example the offer to move expressions that don't depend on the context to an outer level in the containing expression
Returns: For a Value, this always returns the value unchanged
Returns: for a Value, this always returns the value unchanged
Parameters: s the String to be converted
Returns: a double representing the value of the String
Throws: NumberFormatException if the value cannot be converted
Parameters: in the input string whose whitespace is to be removed
Returns: the result of removing excess whitespace
Returns: for a Value, this always returns the value unchanged