Module: VCDOM::XPath::XPathEvaluatorMod

Defined in:
lib/vcdom/xpath/xpath_evaluator_mod.rb

Instance Method Summary collapse

Instance Method Details

#create_expression(expression, resolver) ⇒ Object



12
13
14
# File 'lib/vcdom/xpath/xpath_evaluator_mod.rb', line 12

def create_expression( expression, resolver )
  XPathExpression.new( Internal::Parser.new( expression, resolver ).parse() )
end

#create_ns_resolver(node_resolver) ⇒ Object

Adapts any DOM node to resolve namespaces so that an XPath expression can be easily evaluated relative to the context of the node where it appeared within the document. This adapter works like the DOM Level 3 method lookupNamespaceURI on nodes in resolving the namespaceURI from a given prefix using the current information available in the node’s hierarchy at the time lookupNamespaceURI is called. also correctly resolving the implicit xml prefix.



22
23
24
# File 'lib/vcdom/xpath/xpath_evaluator_mod.rb', line 22

def create_ns_resolver( node_resolver )
  XPathNSResolver.new( node_resolver )
end

#evaluate(expression, context_node, resolver, type, result = nil) ⇒ Object



26
27
28
# File 'lib/vcdom/xpath/xpath_evaluator_mod.rb', line 26

def evaluate( expression, context_node, resolver, type, result = nil )
  return self.create_expression( expression, resolver ).evaluate( context_node, type, result )
end