# File rexml/xpath_parser.rb, line 467 def NodeTest path, nodeset res = nil #puts "NodeTest with '#{path}' and #{puta nodeset}" if DEBUG case path when /^\*/ path = $' res = nodeset.collect {|n| n.kind_of? Element} when NODE_TYPE type = $1 path = $' res = nodeset.collect { |n| case type when 'node' true when 'text' n.kind_of? Text when 'comment' n.kind_of? Comment when 'processing-instruction' n.kind_of? Instruction end } when PI p = path[$&.length..-1] path = $' p =~ LITERAL literal = $1 p = p[$&.length..-1] raise ParseException.new("Missing ')' after processing instruction") if path[0]!=?) res = processing_instruction(literal) when NCNAMETEST #puts "NCNAMETEST #{path}" #puts "PREFIX = #$1" #puts "PATH = #$'" prefix = $1 path = $' res = nodeset.collect {|n| n.kind_of? Namespace and matching_namespace?(n, prefix) } when QNAME #puts "QNAME" #puts "PREFIX = #$1" #puts "NAME = #$2" #puts "PATH = #$'" prefix = $1 name = $2 path = $' prefix = "" unless prefix #puts "QNAME #{prefix}:#{name}, '#{path}'" if DEBUG res = nodeset.collect { |n| n.kind_of? Namespace and name==n.name and matching_namespace?(n, prefix) } end [path, res] end