com.saxonica.bytecode.util
Class Callback

java.lang.Object
  extended by com.saxonica.bytecode.util.Callback

public class Callback
extends Object

A convenient place to put static methods that will be called from generated byte code


Constructor Summary
Callback()
           
 
Method Summary
static int booleanFromString(CharSequence s)
          Convert a string to a boolean value, using the XML Schema rules (including whitespace trimming)
static XPathException makeMultipleItemsException(CardinalityChecker expression, XPathContext context)
          Construct an exception reporting that a sequence of more than item was found where a single item was expected
static XPathException makeNonComparableException(AtomicValue av0, AtomicValue av1, SourceLocator location)
          Construct (but don't throw) an exception reporting that two atomic values are not comparable
static XPathException makeXmlNamespaceException(String prefix, String namespace, Instruction instr)
          Construct (but do not throw) an exception reporting that the namespace prefix "xml" and the XML namespace URI can only be used as a pair
static double stringToNumberOrNaN(StringToDouble s2d, CharSequence string)
          Convert a string to a double number, returning NaN if the string is not numeric
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Callback

public Callback()
Method Detail

makeNonComparableException

public static XPathException makeNonComparableException(AtomicValue av0,
                                                        AtomicValue av1,
                                                        SourceLocator location)
Construct (but don't throw) an exception reporting that two atomic values are not comparable

Parameters:
av0 - the first atomic value
av1 - the second atomic value
location - the source location of the comparison
Returns:
the exception reporting the error

makeXmlNamespaceException

public static XPathException makeXmlNamespaceException(String prefix,
                                                       String namespace,
                                                       Instruction instr)
Construct (but do not throw) an exception reporting that the namespace prefix "xml" and the XML namespace URI can only be used as a pair

Parameters:
prefix - the prefix that was actually used
namespace - the namespace URI that was actually used
instr - the instruction in which the error occurred
Returns:
the exception reporting the error condition

makeMultipleItemsException

public static XPathException makeMultipleItemsException(CardinalityChecker expression,
                                                        XPathContext context)
Construct an exception reporting that a sequence of more than item was found where a single item was expected

Parameters:
expression - the cardinality checker that detects the error. This is re-evaluated to include the first few items of the sequence in the error message
context - the dynamic context
Returns:
the exception object that reports the error

stringToNumberOrNaN

public static double stringToNumberOrNaN(StringToDouble s2d,
                                         CharSequence string)
Convert a string to a double number, returning NaN if the string is not numeric

Parameters:
s2d - the string to double converter to be used
string - the string to be converted
Returns:
the returned number

booleanFromString

public static int booleanFromString(CharSequence s)
Convert a string to a boolean value, using the XML Schema rules (including whitespace trimming)

Parameters:
s - the input string
Returns:
the relevant BooleanValue if validation succeeds; or a ValidationFailure if not.


Copyright (c) 2004-2011 Saxonica Limited. All rights reserved.