class DiffXML::Utils

Public Class Methods

collectXPaths(doc, xpArray) click to toggle source
# File lib/diffXML/utils.rb, line 5
def self.collectXPaths(doc, xpArray)
  doc.element_children.each do |child|
    if child.element_children.empty?
      xpArray.push(getPath(child,child.name)) unless child.content.empty?
    else
      collectXPaths(child, xpArray)
    end
  end
end
getPath(node, path = nil) click to toggle source
# File lib/diffXML/utils.rb, line 15
def self.getPath(node, path = nil)
  if node.parent.name.eql? 'document'
    return path
  else
    if path.nil?
      getPath(node, node.name)
    else
      getPath(node.parent, "#{node.parent.name}/#{path}")
    end
  end
end