Class REXML::XPathParser
In: rexml/xpath_parser.rb
Parent: Object

You don’t want to use this class. Really. Use XPath, which is a wrapper for this class. Believe me. You don’t want to poke around in here. There is strange, dark magic at work in this code. Beware. Go back! Go back while you still can!

Methods

[]=   match   namespaces=   new   parse   predicate   variables=  

Included Modules

XMLTokens

Constants

LITERAL = /^'([^']*)'|^"([^"]*)"/u

Public Class methods

[Source]

# File rexml/xpath_parser.rb, line 14
    def initialize( )
      @parser = REXML::Parsers::XPathParser.new
      @namespaces = {}
      @variables = {}
    end

Public Instance methods

[Source]

# File rexml/xpath_parser.rb, line 42
    def []=( variable_name, value )
      @variables[ variable_name ] = value
    end

[Source]

# File rexml/xpath_parser.rb, line 46
    def match( path_stack, nodeset ) 
      while ( path_stack.size > 0 and nodeset.size > 0 ) 
        #puts "PARSE: #{path_stack.inspect} '#{nodeset.collect{|n|n.class}.inspect}'"

        nodeset = internal_parse( path_stack, nodeset )
        #puts "NODESET: #{nodeset}"

        #puts "PATH_STACK: #{path_stack.inspect}"

      end
      nodeset
    end

[Source]

# File rexml/xpath_parser.rb, line 20
    def namespaces=( namespaces={} )
      Functions::namespace_context = namespaces
      @namespaces = namespaces
    end

[Source]

# File rexml/xpath_parser.rb, line 30
    def parse path, nodeset
      path_stack = @parser.parse( path )
      #puts "PARSE: #{path} => #{path_stack.inspect}"

      #puts "PARSE: nodeset = #{nodeset.collect{|x|x.to_s}.inspect}"

      match( path_stack, nodeset )
    end

[Source]

# File rexml/xpath_parser.rb, line 37
    def predicate path, nodeset
      path_stack = @parser.predicate( path )
      return Predicate( path_stack, nodeset )
    end

[Source]

# File rexml/xpath_parser.rb, line 25
    def variables=( vars={} )
      Functions::variables = vars
      @variables = vars
    end

[Validate]