Package org.eclipse.wst.xml.xpath2.processor.internal


org.eclipse.wst.xml.xpath2.processor.internal
Class DefaultStaticContext



public class DefaultStaticContext
extends java.lang.Object
Default implementation of a static context as described by the XPath 2.0 specification.

Constructor Summary

DefaultStaticContext(org.eclipse.wst.xml.xpath2.api.typesystem.TypeModel model)
DefaultStaticContext()

Method Summary

public voidadd_function_library(FunctionLibrary fl)
     Adds a function to the library.
public voidadd_namespace(java.lang.String prefix , java.lang.String namespace)
     adds namespace
public voidadd_variable(org.eclipse.wst.xml.xpath2.processor.internal.types.QName var)
     Adds a variable to current scope. used for static checking.... i.e. presence of variables
public booleanattribute_declared(org.eclipse.wst.xml.xpath2.processor.internal.types.QName attr)
     Checks if an attribute is in the in-scope schema definitions.
public org.eclipse.wst.xml.xpath2.api.typesystem.TypeDefinitionattribute_type_definition(org.eclipse.wst.xml.xpath2.processor.internal.types.QName elem)
     Retrieves type definition of the attribute in an element.
public org.eclipse.wst.xml.xpath2.processor.internal.types.XSAnyURIbase_uri()
     return the base URI
public voiddebug_print_vars()
     Debug function which will print current variable scopes and info.
public java.lang.Stringdefault_function_namespace()
     Retrieves the defaul function namespace
public java.lang.Stringdefault_namespace()
     Retrieves the default namespace, when one is not allocated
public booleandel_variable(org.eclipse.wst.xml.xpath2.processor.internal.types.QName var)
     Deletes a variable from current scope.
public booleanderives_from(org.eclipse.wst.xml.xpath2.processor.internal.types.NodeType at , org.eclipse.wst.xml.xpath2.processor.internal.types.QName et)
     Checks if an XML node derives from a specified type.
public booleanderives_from(org.eclipse.wst.xml.xpath2.processor.internal.types.NodeType at , org.eclipse.wst.xml.xpath2.api.typesystem.TypeDefinition et)
     Checks if an XML node derives from a specified type definition.
public voiddestroy_scope()
     Destroys a scope.
public booleanelement_declared(org.eclipse.wst.xml.xpath2.processor.internal.types.QName elem)
     is element declared?
public org.eclipse.wst.xml.xpath2.api.typesystem.TypeDefinitionelement_type_definition(org.eclipse.wst.xml.xpath2.processor.internal.types.QName elem)
     Obtains schema definition of the type of an element.
public booleanexpand_elem_type_qname(org.eclipse.wst.xml.xpath2.processor.internal.types.QName name)
     Expands a qname and uses the default type/element namespace if unprefixed.
public booleanexpand_function_qname(org.eclipse.wst.xml.xpath2.processor.internal.types.QName name)
     Expands a qname and uses the default function namespace if unprefixed.
public booleanexpand_qname(org.eclipse.wst.xml.xpath2.processor.internal.types.QName name)
     Expands the qname's prefix into a namespace.
public Functionfunction(org.eclipse.wst.xml.xpath2.processor.internal.types.QName name , int arity)
    
public booleanfunction_exists(org.eclipse.wst.xml.xpath2.processor.internal.types.QName name , int arity)
     Check for existance of function.
public java.lang.Stringget_cntxt_item_type()
    
public java.util.Mapget_collections()
    
public java.lang.Stringget_default_collection_type()
    
public java.util.Mapget_documents()
    
public java.util.Mapget_function_libraries()
    
protected java.lang.Objectget_var(org.eclipse.wst.xml.xpath2.processor.internal.types.QName var)
    
public org.eclipse.wst.xml.xpath2.api.typesystem.TypeModelgetTypeModel(org.w3c.dom.Node node)
    
public org.eclipse.wst.xml.xpath2.processor.internal.types.AnyAtomicTypemake_atomic(org.eclipse.wst.xml.xpath2.processor.internal.types.QName name)
     Creates an atomic from a specific type name initialized with a default value.
public voidnew_scope()
     Creates a new scope level.
public booleanprefix_exists(java.lang.String pref)
     does prefix exist?
public java.lang.Stringresolve_prefix(java.lang.String pref)
     Resolves a prefix into a namespace URI.
public voidset_base_uri(java.lang.String baseuri)
     Set the Base URI for the static context.
public voidset_cntxt_item_type(java.lang.String cntxtItemType)
    
public voidset_collections(java.util.Map collections)
    
public voidset_default_collection_type(java.lang.String defaultCollectionType)
    
public voidset_documents(java.util.Map _documents)
    
protected voidset_variable(org.eclipse.wst.xml.xpath2.processor.internal.types.QName var , org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType val)
    
protected voidset_variable(org.eclipse.wst.xml.xpath2.processor.internal.types.QName var , org.eclipse.wst.xml.xpath2.processor.ResultSequence val)
    
public booleantype_defined(org.eclipse.wst.xml.xpath2.processor.internal.types.QName qname)
     Checks whether the type is defined in the in scope schema definitions.
public booleantype_defined(java.lang.String ns , java.lang.String type)
     Checks whether the type is defined in the in scope schema definitions.
public booleanvariable_exists(org.eclipse.wst.xml.xpath2.processor.internal.types.QName var)
     does variable exist in current scope ?
public booleanvariable_in_scope(org.eclipse.wst.xml.xpath2.processor.internal.types.QName var)
     checks to see if variable is in scope
public booleanxpath1_compatible()
     is it xpath1 compatible?

Constructor Detail

DefaultStaticContext

public DefaultStaticContext(org.eclipse.wst.xml.xpath2.api.typesystem.TypeModel model)

Constructor.


DefaultStaticContext

public DefaultStaticContext()

Constructor for schema-less documents.


Methods Detail

add_function_library

public void add_function_library(FunctionLibrary fl)

Adds a function to the library.

Parameters

fl - Function library to add.


add_namespace

public void add_namespace(java.lang.String prefix , java.lang.String namespace)

adds namespace

Parameters

prefix - namespace prefix

namespace - namespace URI


add_variable

public void add_variable(org.eclipse.wst.xml.xpath2.processor.internal.types.QName var)

Adds a variable to current scope. used for static checking.... i.e. presence of variables

Parameters

var - variable name to add.


attribute_declared

public boolean attribute_declared(org.eclipse.wst.xml.xpath2.processor.internal.types.QName attr)

Checks if an attribute is in the in-scope schema definitions.

Parameters

attr - name of attribute.

Returns

boolean - true if attribute is declared.


attribute_type_definition

public org.eclipse.wst.xml.xpath2.api.typesystem.TypeDefinition attribute_type_definition(org.eclipse.wst.xml.xpath2.processor.internal.types.QName elem)

Retrieves type definition of the attribute in an element.

Parameters

elem - element name

Returns

org.eclipse.wst.xml.xpath2.api.typesystem.TypeDefinition - schema definition of the type of the attribute


base_uri

public org.eclipse.wst.xml.xpath2.processor.internal.types.XSAnyURI base_uri()

return the base URI

Returns

org.eclipse.wst.xml.xpath2.processor.internal.types.XSAnyURI - XSAnyURI


debug_print_vars

public void debug_print_vars()

Debug function which will print current variable scopes and info.


default_function_namespace

public java.lang.String default_function_namespace()

Retrieves the defaul function namespace

Returns

java.lang.String - string


default_namespace

public java.lang.String default_namespace()

Retrieves the default namespace, when one is not allocated

Returns

java.lang.String - string


del_variable

public boolean del_variable(org.eclipse.wst.xml.xpath2.processor.internal.types.QName var)

Deletes a variable from current scope.

Parameters

var - variable name to delete.

Returns

boolean - false if variable doesn't exist.


derives_from

public boolean derives_from(org.eclipse.wst.xml.xpath2.processor.internal.types.NodeType at , org.eclipse.wst.xml.xpath2.processor.internal.types.QName et)

Checks if an XML node derives from a specified type.

Parameters

at - node actual type

et - name of expected type

Returns

boolean - true if a derivation exists


derives_from

public boolean derives_from(org.eclipse.wst.xml.xpath2.processor.internal.types.NodeType at , org.eclipse.wst.xml.xpath2.api.typesystem.TypeDefinition et)

Checks if an XML node derives from a specified type definition.

Parameters

at - node actual type.

et - type definition of expected type.

Returns

boolean - true if a derivation exists.


destroy_scope

public void destroy_scope()

Destroys a scope.


element_declared

public boolean element_declared(org.eclipse.wst.xml.xpath2.processor.internal.types.QName elem)

is element declared?

Parameters

elem - name of element.

Returns

boolean - true if element declared.


element_type_definition

public org.eclipse.wst.xml.xpath2.api.typesystem.TypeDefinition element_type_definition(org.eclipse.wst.xml.xpath2.processor.internal.types.QName elem)

Obtains schema definition of the type of an element.

Parameters

elem - name of element who's type is desired.

Returns

org.eclipse.wst.xml.xpath2.api.typesystem.TypeDefinition - schema definition of type


expand_elem_type_qname

public boolean expand_elem_type_qname(org.eclipse.wst.xml.xpath2.processor.internal.types.QName name)

Expands a qname and uses the default type/element namespace if unprefixed.

Parameters

name - qname to expand.

Returns

boolean - true on success.


expand_function_qname

public boolean expand_function_qname(org.eclipse.wst.xml.xpath2.processor.internal.types.QName name)

Expands a qname and uses the default function namespace if unprefixed.

Parameters

name - qname to expand.

Returns

boolean - true on success.


expand_qname

public boolean expand_qname(org.eclipse.wst.xml.xpath2.processor.internal.types.QName name)

Expands the qname's prefix into a namespace.

Parameters

name - qname to expand.

Returns

boolean - true on success.


function

public Function function(org.eclipse.wst.xml.xpath2.processor.internal.types.QName name , int arity)

Parameters

name

arity

Returns

Function


function_exists

public boolean function_exists(org.eclipse.wst.xml.xpath2.processor.internal.types.QName name , int arity)

Check for existance of function.

Parameters

name - function name.

arity - arity of function.

Returns

boolean - true if function exists. False otherwise.


get_cntxt_item_type

public java.lang.String get_cntxt_item_type()

Returns

java.lang.String


get_collections

public java.util.Map get_collections()

Returns

java.util.Map


get_default_collection_type

public java.lang.String get_default_collection_type()

Returns

java.lang.String


get_documents

public java.util.Map get_documents()

Returns

java.util.Map


get_function_libraries

public java.util.Map get_function_libraries()

Returns

java.util.Map


get_var

protected java.lang.Object get_var(org.eclipse.wst.xml.xpath2.processor.internal.types.QName var)

Parameters

var

Returns

java.lang.Object


getTypeModel

public org.eclipse.wst.xml.xpath2.api.typesystem.TypeModel getTypeModel(org.w3c.dom.Node node)

Parameters

node

Returns

org.eclipse.wst.xml.xpath2.api.typesystem.TypeModel


make_atomic

public org.eclipse.wst.xml.xpath2.processor.internal.types.AnyAtomicType make_atomic(org.eclipse.wst.xml.xpath2.processor.internal.types.QName name)

Creates an atomic from a specific type name initialized with a default value.

Parameters

name - name of type to create

Returns

org.eclipse.wst.xml.xpath2.processor.internal.types.AnyAtomicType - Atomic type of desired type.


new_scope

public void new_scope()

Creates a new scope level.


prefix_exists

public boolean prefix_exists(java.lang.String pref)

does prefix exist?

Parameters

pref - prefix name.

Returns

boolean - true if it does.


resolve_prefix

public java.lang.String resolve_prefix(java.lang.String pref)

Resolves a prefix into a namespace URI.

Parameters

pref - prefix name

Returns

java.lang.String - uri prefix is resolved to or null.


set_base_uri

public void set_base_uri(java.lang.String baseuri)

Set the Base URI for the static context.

Parameters

baseuri


set_cntxt_item_type

public void set_cntxt_item_type(java.lang.String cntxtItemType)

Parameters

cntxtItemType


set_collections

public void set_collections(java.util.Map collections)

Parameters

collections


set_default_collection_type

public void set_default_collection_type(java.lang.String defaultCollectionType)

Parameters

defaultCollectionType


set_documents

public void set_documents(java.util.Map _documents)

Parameters

_documents


set_variable

protected void set_variable(org.eclipse.wst.xml.xpath2.processor.internal.types.QName var , org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType val)

Parameters

var

val


set_variable

protected void set_variable(org.eclipse.wst.xml.xpath2.processor.internal.types.QName var , org.eclipse.wst.xml.xpath2.processor.ResultSequence val)

Parameters

var

val


type_defined

public boolean type_defined(org.eclipse.wst.xml.xpath2.processor.internal.types.QName qname)

Checks whether the type is defined in the in scope schema definitions.

Parameters

qname - type name.

Returns

boolean - true if type is defined.


type_defined

public boolean type_defined(java.lang.String ns , java.lang.String type)

Checks whether the type is defined in the in scope schema definitions.

Parameters

ns - namespace of type.

type - name of type.

Returns

boolean - true if type is defined.


variable_exists

public boolean variable_exists(org.eclipse.wst.xml.xpath2.processor.internal.types.QName var)

does variable exist in current scope ?

Parameters

var - variable name.

Returns

boolean - true if it does.


variable_in_scope

public boolean variable_in_scope(org.eclipse.wst.xml.xpath2.processor.internal.types.QName var)

checks to see if variable is in scope

Parameters

var - variable name.

Returns

boolean - true if variable is in current or above scope.


xpath1_compatible

public boolean xpath1_compatible()

is it xpath1 compatible?

Returns

boolean - boolean