REXML::XPathParser (Class)

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

[]=   namespaces=   new   parse   predicate   variables=  

Constants

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

Included Modules

XMLTokens

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 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]