public Diff build() {

        final DOMDifferenceEngine d = new DOMDifferenceEngine();
        final CollectResultsListener collectResultsListener = new CollectResultsListener(comparisonResultsToCheck);
        d.addDifferenceListener(collectResultsListener);
        if (nodeMatcher != null) {
            d.setNodeMatcher(nodeMatcher);
        }
        d.setDifferenceEvaluator(differenceEvaluator);
        d.setComparisonController(comparisonController);
        for (ComparisonListener comparisonListener : comparisonListeners) {
            d.addComparisonListener(comparisonListener);
        }
        for (ComparisonListener comparisonListener : differenceListeners) {
            d.addDifferenceListener(comparisonListener);
        }
        if (namespaceContext != null) {
            d.setNamespaceContext(namespaceContext);
        }
        if (attributeFilter != null) {
            d.setAttributeFilter(attributeFilter);
        }
        if (nodeFilter != null) {
            d.setNodeFilter(nodeFilter);
        }
        if (documentBuilderFactory != null) {
            d.setDocumentBuilderFactory(documentBuilderFactory);
        }
        d.compare(wrap(controlSource), wrap(testSource));

        return formatter == null
            ? new Diff(controlSource, testSource, collectResultsListener.getDifferences())
            : new Diff(controlSource, testSource, formatter,
                       collectResultsListener.getDifferences());
    }
public Diff build ( ) { final DOMDifferenceEngine d = new DOMDifferenceEngine ( ) ; final CollectResultsListener collectResultsListener = new CollectResultsListener ( comparisonResultsToCheck ) ; d . addDifferenceListener ( collectResultsListener ) ; if ( nodeMatcher != null ) { d . setNodeMatcher ( nodeMatcher ) ; } d . setDifferenceEvaluator ( differenceEvaluator ) ; d . setComparisonController ( comparisonController ) ; for ( ComparisonListener comparisonListener : comparisonListeners ) { d . addComparisonListener ( comparisonListener ) ; } for ( ComparisonListener comparisonListener : differenceListeners ) { d . addDifferenceListener ( comparisonListener ) ; } if ( namespaceContext != null ) { d . setNamespaceContext ( namespaceContext ) ; } if ( attributeFilter != null ) { d . setAttributeFilter ( attributeFilter ) ; } if ( nodeFilter != null ) { d . setNodeFilter ( nodeFilter ) ; } if ( documentBuilderFactory != null ) { d . setDocumentBuilderFactory ( documentBuilderFactory ) ; } d . compare ( wrap ( controlSource ) , wrap ( testSource ) ) ; return formatter == null ? new Diff ( controlSource , testSource , collectResultsListener . getDifferences ( ) ) : new Diff ( controlSource , testSource , formatter , collectResultsListener . getDifferences ( ) ) ; }
Compare the Test-XML {@link #withTest(Object)} with the Control-XML {@link #compare(Object)} and return the
collected differences in a {@link Diff} object.