title: XML comparison with XMLUnit not working in specific scenario where list has different complex element and ordering
body: <p>I have below XMLs with list of Customers and each Customer has list of transactions. I have managed to write XMLUnit code to ignore the order of Customers but not the transactions. The transactions have bit of unique structure(which cannot be altered). Below are the sample XMLs and code. Please help.</p>
  <p><strong>XML 1:</strong></p>
  <pre><code>&lt;Customers&gt;
    &lt;Customer&gt;
      &lt;Id&gt;1&lt;/Id&gt;
      &lt;Transactions&gt;
        &lt;Transaction&gt;
          &lt;CashTransaction&gt;
            &lt;amount&gt;100&lt;/amount&gt;
          &lt;/CashTransaction&gt;
        &lt;/Transaction&gt;
        &lt;Transaction&gt;
          &lt;CardTransaction&gt;
            &lt;amount&gt;200&lt;/amount&gt;
          &lt;/CardTransaction&gt;
        &lt;/Transaction&gt;
      &lt;/Transactions&gt;
    &lt;/Customer&gt;
    &lt;Customer&gt;
      &lt;Id&gt;2&lt;/Id&gt;
      &lt;Transactions&gt;
        &lt;Transaction&gt;
          &lt;CardTransaction&gt;
            &lt;amount&gt;500&lt;/amount&gt;
          &lt;/CardTransaction&gt;
        &lt;/Transaction&gt;
        &lt;Transaction&gt;
          &lt;CashTransaction&gt;
            &lt;amount&gt;400&lt;/amount&gt;
          &lt;/CashTransaction&gt;
        &lt;/Transaction&gt;
      &lt;/Transactions&gt;
    &lt;/Customer&gt;
  &lt;/Customers&gt;
  </code></pre>
  <p><strong>XML 2:</strong></p>
  <pre><code>&lt;Customers&gt;
    &lt;Customer&gt;
      &lt;Id&gt;2&lt;/Id&gt;
      &lt;Transactions&gt;
        &lt;Transaction&gt;
          &lt;CashTransaction&gt;
            &lt;amount&gt;400&lt;/amount&gt;
          &lt;/CashTransaction&gt;
        &lt;/Transaction&gt;
        &lt;Transaction&gt;
          &lt;CardTransaction&gt;
            &lt;amount&gt;500&lt;/amount&gt;
          &lt;/CardTransaction&gt;
        &lt;/Transaction&gt;
      &lt;/Transactions&gt;
    &lt;/Customer&gt;
    &lt;Customer&gt;
      &lt;Id&gt;1&lt;/Id&gt;
      &lt;Transactions&gt;
        &lt;Transaction&gt;
          &lt;CardTransaction&gt;
            &lt;amount&gt;200&lt;/amount&gt;
          &lt;/CardTransaction&gt;
        &lt;/Transaction&gt;
        &lt;Transaction&gt;
          &lt;CashTransaction&gt;
            &lt;amount&gt;100&lt;/amount&gt;
          &lt;/CashTransaction&gt;
        &lt;/Transaction&gt;
      &lt;/Transactions&gt;
    &lt;/Customer&gt;
  &lt;/Customers&gt;
  </code></pre>
  <p><strong>Code:</strong></p>
  <pre><code>
      Diff diffs = DiffBuilder.compare(Input.from(resourceAsStream1))
          .withTest(Input.from(resourceAsStream2))
          .ignoreComments()
          .ignoreWhitespace()
          .normalizeWhitespace()
          .checkForSimilar()
          .withDifferenceEvaluator(evaluator)
          .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.conditionalBuilder()
              .whenElementIsNamed(&quot;Customer&quot;)
              .thenUse(ElementSelectors.byXPath(&quot;./Id&quot;, ElementSelectors.byNameAndText))
              .elseUse(ElementSelectors.byName)
              .build()
          )).build();
  </code></pre>
  <p><strong>Differences shown:</strong></p>
  <pre><code>Expected child 'CashTransaction' but was 'null' - comparing &lt;CashTransaction...&gt; at /Customers[1]/Customer[1]/Transactions[1]/Transaction[1]/CashTransaction[1] to &lt;NULL&gt;
  Expected child 'null' but was 'CardTransaction' - comparing &lt;NULL&gt; to &lt;CardTransaction...&gt; at /Customers[1]/Customer[2]/Transactions[1]/Transaction[1]/CardTransaction[1]
  Expected child 'CardTransaction' but was 'null' - comparing &lt;CardTransaction...&gt; at /Customers[1]/Customer[1]/Transactions[1]/Transaction[2]/CardTransaction[1] to &lt;NULL&gt;
  Expected child 'null' but was 'CashTransaction' - comparing &lt;NULL&gt; to &lt;CashTransaction...&gt; at /Customers[1]/Customer[2]/Transactions[1]/Transaction[2]/CashTransaction[1]
  ..
  ..
  
  </code></pre>