Self-closing Comparison Issue in XmlUnit.Net

  • Colin Parker

    Colin Parker - 2008-10-13

    I am testing comparisons of standard and self-terminating elements and came across an interesting issue.  The following works fine, as I would have expected:
    string input1 = "<empty/>";
    string input2 = "<empty></empty>";
    AssertExpectedResult(input1, input2, true);
    AssertExpectedResult(input2, input1, true);

    When I add an attribute to the elements, the order of the comparison parameters dictates whether they are considered equal or not:
    string input1 = "<empty name='Test'/>";
    string input2 = "<empty name='Test'></empty>";
    AssertExpectedResult(input1, input2, true); // Passes
    AssertExpectedResult(input2, input1, true); // Fails

    The failure error is: CHILD_NODELIST_LENGTH_ID and appears to stem from the processing of the test XmlReader.Read() result.  I would have expected both asserts to either pass or fail.  I'm currently pre-processing all XML to prevent empty nodes from existing to work around this, but is there anything I can do with XmlUnit itself to resolve this?

    Colin P.

    • Stefan Bodewig

      Stefan Bodewig - 2008-10-17

      the .NET version still is somewhat neglected.  I'd consider what you see a bug, please open a bug report for it.

      A unit test ready to be added to the source tree and - if you can track it down - a patch would be much appreciated.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks