# File rexml/xpath_parser.rb, line 447 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 prefix = $1 path = $' res = nodeset.collect {|n| n.kind_of? Namespace and matching_namespace?(n, prefix) } when QNAME prefix = $1 name = $2 path = $' prefix = "" unless prefix #puts "QNAME #{prefix}:#{name}, '#{path}'" if DEBUG res = nodeset.collect { |n| #print "\n#{n.name if n.kind_of? Namespace}: #{n.kind_of? Namespace} and #{name==n.name if n.kind_of? Namespace} and #{matching_namespace?(n, prefix) if n.kind_of? Namespace}" if DEBUG n.kind_of? Namespace and name==n.name and matching_namespace?(n, prefix) } end [path, res] end