class XMLBuilder::PathParser

Parses an xpath like expression

Parses an xpath like expression

Public Class Methods

parse(path) click to toggle source
# File lib/ec2/amitools/xmlbuilder.rb, line 71
def PathParser.parse(path)
  nodes = path.split('/')
  @nodes = []
  first = true

  while (nodes.length > 0)
    node = Node.new(first, nodes)
    first = false
    @nodes << Document.new() if node.document
    @nodes << Element.new(node.element, node.index) if node.element
    @nodes << Attribute.new(node.attribute) if node.attribute
  end
  @nodes
end