code: public static DifferenceEvaluator ignorePrologDifferencesExceptDoctype() {
          return new DifferenceEvaluator() {
              @Override
              public ComparisonResult evaluate(Comparison comparison, ComparisonResult orig) {
                  return belongsToProlog(comparison, false)
                      || isSequenceOfRootElement(comparison)
                      ? ComparisonResult.EQUAL : orig;
              }
          };
      }
docs: Ignore any differences except differences inside the doctype
  declaration that are part of the <a
  href="https://www.w3.org/TR/2008/REC-xml-20081126/#sec-prolog-dtd">XML
  prolog</a>.
  
  <p>Here "ignore" means return {@code ComparisonResult.EQUAL}.</p>
  
  <p>This is one of the building blocks for mimicing the behavior
  of XMLUnit for Java 1.x. In order to get the same behavior you
  need:</p>
  
  <pre>
  chain(Default, // so CDATA and Text are the same
  ignorePrologDifferencesExceptDoctype()) // so most of the prolog is ignored
  </pre>
  
  <p>In general different doctype declarations will be ignored
  because of {@link NodeFilters.Default}, so if you want to
  detect these differences you need to pick a different {@code
  NodeFilter}.</p>
  
  @since XMLUnit 2.1.0