method
RelativeLocationPath
v1_9_3_125 -
Show latest stable
- Class:
REXML::Parsers::XPathParser
RelativeLocationPath(path, parsed)private
No documentation available.
# File lib/rexml/parsers/xpathparser.rb, line 212
def RelativeLocationPath path, parsed
#puts "RelativeLocationPath #{path}"
while path.size > 0
# (axis or @ or <child::>) nodetest predicate >
# OR > / Step
# (. or ..) >
if path[0] == ..
if path[1] == ..
parsed << :parent
parsed << :node
path = path[2..-1]
else
parsed << :self
parsed << :node
path = path[1..-1]
end
else
if path[0] == @@
#puts "ATTRIBUTE"
parsed << :attribute
path = path[1..-1]
# Goto Nodetest
elsif path =~ AXIS
parsed << $1.tr('-','_').intern
path = $'
# Goto Nodetest
else
parsed << :child
end
#puts "NODETESTING '#{path}'"
n = []
path = NodeTest( path, n)
#puts "NODETEST RETURNED '#{path}'"
if path[0] == [[
path = Predicate( path, n )
end
parsed.concat(n)
end
if path.size > 0
if path[0] == //
if path[1] == //
parsed << :descendant_or_self
parsed << :node
path = path[2..-1]
else
path = path[1..-1]
end
else
return path
end
end
end
return path
end