Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] XOMTestCase.compareChildren() should be insensitive to empty text nodes

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Wolfgang Hoschek <wolfgang.hoschek AT mac.com>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: [XOM-interest] XOMTestCase.compareChildren() should be insensitive to empty text nodes
  • Date: Thu, 25 Jan 2007 16:16:29 -0800

XOMTestCase.compareChildren() compares two children for "equality". Ala XPath, it merges adjacent text nodes before doing so, which is fine, but the comparison isn't insensitive to empty text nodes, which seems wrong for all intents and purposes. The following test case should pass but currently fails:

public void testEmptyTextComparison() {

Element expected = new Element("foo");
Element actual = new Element("foo");

actual.appendChild(new Text(""));
assertEquals("Comparison should be insensitive to empty text nodes", expected, actual);

actual.appendChild(new Text(""));
assertEquals("Comparison should be insensitive to empty text nodes", expected, actual);

actual.appendChild(new Text(""));
assertEquals("Comparison should be insensitive to empty text nodes", expected, actual);

expected.appendChild(new Text(""));
assertEquals("Comparison should be insensitive to empty text nodes", expected, actual);
}





Archive powered by MHonArc 2.6.24.

Top of Page