require 'compare-xml'
left_s = <<EOS
<?xml version="1.0" encoding="UTF-8"?>
<project>
<keepDependencies>false</keepDependencies>
<properties>
<hudson.plugins.buildblocker.BuildBlockerProperty plugin="[email protected]">
<useBuildBlocker>false</useBuildBlocker>
<blockLevel>GLOBAL</blockLevel>
<scanQueueFor>DISABLED</scanQueueFor>
<blockingJobs/>
</hudson.plugins.buildblocker.BuildBlockerProperty>
<com.sonyericsson.rebuild.RebuildSettings plugin="[email protected]">
<autoRebuild>false</autoRebuild>
<rebuildDisabled>false</rebuildDisabled>
</com.sonyericsson.rebuild.RebuildSettings>
<hudson.model.ParametersDefinitionProperty>
<parameterDefinitions>
<hudson.model.StringParameterDefinition>
<name>approval_message</name>
<defaultValue/>
</hudson.model.StringParameterDefinition>
</parameterDefinitions>
</hudson.model.ParametersDefinitionProperty>
</properties>
</project>
EOS
right_s = <<EOS
<?xml version="1.0" encoding="UTF-8"?>
<project>
<keepDependencies>false</keepDependencies>
<properties>
<hudson.model.ParametersDefinitionProperty>
<parameterDefinitions>
<hudson.model.StringParameterDefinition>
<name>approval_message</name>
<defaultValue/>
</hudson.model.StringParameterDefinition>
</parameterDefinitions>
</hudson.model.ParametersDefinitionProperty>
</properties>
</project>
EOS
left = Nokogiri::XML left_s
right = Nokogiri::XML right_s
res = CompareXML.equivalent? left, right, verbose: true
pp res
[{:node1=>
#(Element:0x3c {
name = "hudson.plugins.buildblocker.BuildBlockerProperty",
attributes = [
#(Attr:0x50 { name = "plugin", value = "[email protected]" })],
children = [
#(Text "\n" + " "),
#(Element:0x64 {
name = "useBuildBlocker",
children = [ #(Text "false")]
}),
#(Text "\n" + " "),
#(Element:0x78 { name = "blockLevel", children = [ #(Text "GLOBAL")] }),
#(Text "\n" + " "),
#(Element:0x8c {
name = "scanQueueFor",
children = [ #(Text "DISABLED")]
}),
#(Text "\n" + " "),
#(Element:0xa0 { name = "blockingJobs" }),
#(Text "\n" + " ")]
}),
:node2=>
#(Element:0xb4 {
name = "hudson.model.ParametersDefinitionProperty",
children = [
#(Text "\n" + " "),
#(Element:0xc8 {
name = "parameterDefinitions",
children = [
#(Text "\n" + " "),
#(Element:0xdc {
name = "hudson.model.StringParameterDefinition",
children = [
#(Text "\n" + " "),
#(Element:0xf0 {
name = "name",
children = [ #(Text "approval_message")]
}),
#(Text "\n" + " "),
#(Element:0x104 { name = "defaultValue" }),
#(Text "\n" + " ")]
}),
#(Text "\n" + " ")]
}),
#(Text "\n" + " ")]
}),
:diff1=>"hudson.plugins.buildblocker.BuildBlockerProperty",
:diff2=>"hudson.model.ParametersDefinitionProperty"}]