lib/compare-xml.rb in compare-xml-0.65 vs lib/compare-xml.rb in compare-xml-0.66
- old
+ new
@@ -14,10 +14,14 @@
# when true, children of elements are always compared
# when false, children of elements are not compared if the root is different
force_children: false,
+ # when true, children of elements are never compared
+ # when false, children of elements are compared if root is different or see force_children
+ ignore_children: false,
+
# contains an array of user specified strings that is used to ignore any attributes
# whose content contains a string from this array (e.g. "good automobile" contains "mobile")
ignore_attr_content: [],
# contains an array of user-specified CSS rules used to perform attribute exclusions
@@ -189,9 +193,10 @@
#
# @return type of equivalence (from equivalence constants)
#
def compareChildren(n1_set, n2_set, opts, differences, diffchildren = false, status = EQUIVALENT)
i = 0; j = 0
+ return if opts[:ignore_children]
while i < n1_set.length || j < n2_set.length
if !n1_set[i].nil? && nodeExcluded?(n1_set[i], opts)
i += 1 # increment counter if left node is excluded
elsif !n2_set[j].nil? && nodeExcluded?(n2_set[j], opts)
j += 1 # increment counter if right node is excluded