org.ucl.xpath
Class DefaultDynamicContext

java.lang.Object
  extended byorg.ucl.xpath.DefaultStaticContext
      extended byorg.ucl.xpath.DefaultDynamicContext
All Implemented Interfaces:
DynamicContext, StaticContext

public class DefaultDynamicContext
extends DefaultStaticContext
implements DynamicContext

The default implementation of a Dynamic Context. Initializes and provides functionality of a dynamic context according to the XPath 2.0 specification.


Constructor Summary
DefaultDynamicContext(org.apache.xerces.xs.XSModel schema, org.w3c.dom.Document doc)
          Constructor.
 
Method Summary
 void add_function_library(FunctionLibrary fl)
          Adds function definitions.
 AnyType context_item()
          Retrieve context item that is in focus
 int context_position()
          Retrieve the position of the focus
 ResultSequence evaluate_function(QName name, java.util.Collection args)
          Evaluate the function of the arguments.
 Focus focus()
          Return the focus
 ResultSequence get_doc(java.lang.String uri)
          get document
 AnyType get_variable(QName name)
          Retrieve the variable name
 int last()
          Retrieve the position of the last focus
 int node_position(org.w3c.dom.Node node)
          Retrieve integer of the position of node
 void set_focus(Focus f)
          Changes the current focus.
 void set_variable(QName var, AnyType val)
          Sets the value of a variable.
 XDTDayTimeDuration tz()
          Reads the day from a TimeDuration type
 
Methods inherited from class org.ucl.xpath.DefaultStaticContext
add_namespace, add_variable, attribute_declared, attribute_type_definition, base_uri, debug_print_vars, default_function_namespace, default_namespace, del_variable, derives_from, derives_from, destroy_scope, element_declared, element_type_definition, expand_elem_type_qname, expand_function_qname, expand_qname, function_exists, function, get_var, make_atomic, new_scope, prefix_exists, resolve_prefix, type_defined, type_defined, variable_exists, variable_in_scope, xpath1_compatible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.ucl.xpath.StaticContext
add_namespace, add_variable, attribute_declared, attribute_type_definition, base_uri, default_function_namespace, default_namespace, del_variable, derives_from, derives_from, destroy_scope, element_declared, element_type_definition, expand_elem_type_qname, expand_function_qname, expand_qname, function_exists, make_atomic, new_scope, prefix_exists, resolve_prefix, type_defined, variable_exists, variable_in_scope, xpath1_compatible
 

Constructor Detail

DefaultDynamicContext

public DefaultDynamicContext(org.apache.xerces.xs.XSModel schema,
                             org.w3c.dom.Document doc)
Constructor.

Parameters:
schema - Schema information of document. May be null
doc - Document [root] node of XML source.
Method Detail

tz

public XDTDayTimeDuration tz()
Reads the day from a TimeDuration type

Specified by:
tz in interface DynamicContext
Returns:
an xs:integer _tz

set_focus

public void set_focus(Focus f)
Changes the current focus.

Specified by:
set_focus in interface DynamicContext
Parameters:
f - focus to set

focus

public Focus focus()
Return the focus

Specified by:
focus in interface DynamicContext
Returns:
_focus

context_item

public AnyType context_item()
Retrieve context item that is in focus

Specified by:
context_item in interface DynamicContext
Returns:
an AnyType result from _focus.context_item()

context_position

public int context_position()
Retrieve the position of the focus

Specified by:
context_position in interface DynamicContext
Returns:
an integer result from _focus.position()

last

public int last()
Retrieve the position of the last focus

Specified by:
last in interface DynamicContext
Returns:
an integer result from _focus.last()

get_variable

public AnyType get_variable(QName name)
Retrieve the variable name

Specified by:
get_variable in interface DynamicContext
Parameters:
name - is the name of the variable.
Returns:
an AnyType result from get_var(name) or return NULL

evaluate_function

public ResultSequence evaluate_function(QName name,
                                        java.util.Collection args)
                                 throws DynamicError
Description copied from interface: DynamicContext
Evaluate the function of the arguments.

Specified by:
evaluate_function in interface DynamicContext
Parameters:
name - is the name.
args - are the arguments.
Returns:
a ResultSequence from funct.evaluate(args)
Throws:
DynamicError - dynamic error.

add_function_library

public void add_function_library(FunctionLibrary fl)
Adds function definitions.

Specified by:
add_function_library in interface StaticContext
Overrides:
add_function_library in class DefaultStaticContext
Parameters:
fl - Function library to add.

get_doc

public ResultSequence get_doc(java.lang.String uri)
get document

Specified by:
get_doc in interface DynamicContext
Parameters:
uri - is the URI of the document.
Returns:
a ResultSequence from ResultSequenceFactory.create_new()

set_variable

public void set_variable(QName var,
                         AnyType val)
Sets the value of a variable.

Specified by:
set_variable in interface DynamicContext
Overrides:
set_variable in class DefaultStaticContext
Parameters:
var - Variable name.
val - Variable value.

node_position

public int node_position(org.w3c.dom.Node node)
Retrieve integer of the position of node

Specified by:
node_position in interface DynamicContext
Parameters:
node - is the node.
Returns:
integer from _node_order.get(node)