Iterator i1 = node1.getChildIterator();
Iterator i2 = node2.getChildIterator();
// Skip all ignorable whitespace and compare with strict order
if (i1.hasNext() && i2.hasNext()) {
XMLNode child1 = (XMLNode) i1.next();
XMLNode child2 = (XMLNode) i2.next();
while (child1 != null && child2 != null) {
if (nodeIsIgnorableText(child1)) {
if (!i1.hasNext()) {
break;
}
child1 = (XMLNode) i1.next();
continue;
}
if (nodeIsIgnorableText(child2)) {
if (!i2.hasNext()) {
break;
}
child2 = (XMLNode) i2.next();
continue;
}
diffCount += compareNodes(child1, child2);
if (!i1.hasNext() || !i2.hasNext()) {
break;
}
child1 = (XMLNode) i1.next();
child2 = (XMLNode) i2.next();
}
}
// If we have excess nodes for root1, complain about missing elements
while (i1.hasNext()) {
XMLNode child1 = (XMLNode) i1.next();
if (!nodeIsIgnorableText(child1)) {
if (_print) {
printLocationInfo(child1, null);
_pw.println("- ");
}
++diffCount;
}
}
// If we have excess nodes for root2, complain about extra elements
while (i2.hasNext()) {
XMLNode child2 = (XMLNode) i2.next();
if (!nodeIsIgnorableText(child2)) {
if (_print) {
printLocationInfo(child2, null);
_pw.println("- ");
}