Module: DiffXML

Defined in:
lib/diffxml.rb,
lib/diffXML/utils.rb

Defined Under Namespace

Classes: Utils

Class Method Summary collapse

Class Method Details

.compareToPath(path, doc1, doc2) ⇒ Object



18
19
20
# File 'lib/diffxml.rb', line 18

def self.compareToPath(path, doc1, doc2)
  doc2.search(path, @namespaces).to_s == doc1.search(path, @namespaces).to_s
end

.compareXML(doc1, doc2) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/diffxml.rb', line 6

def self.compareXML(doc1, doc2)
  @namespaces = doc1.collect_namespaces
  if doc1.class == Nokogiri::XML::Document
    DiffXML::Utils.collectXPaths(doc1.root, @xpathArray)
  else
    DiffXML::Utils.collectXPaths(doc1, @xpathArray)
  end
  @xpathArray.delete_if do |element|
    compareToPath(element, doc1, doc2)
  end
end

.getXPathArrayObject



22
23
24
# File 'lib/diffxml.rb', line 22

def self.getXPathArray
  @xpathArray
end