Compare two attributes
@param control
@param test
@param listener
@throws DifferenceFoundException
776
protected void compareRecognizedXMLSchemaInstanceAttribute(Attr control,
                                                               Attr test,
                                                               DifferenceListener listener)
        throws DifferenceFoundException {
        Attr nonNullNode = control != null ? control : test;
        Difference d = 
            XMLConstants.W3C_XML_SCHEMA_INSTANCE_SCHEMA_LOCATION_ATTR
            .equals(nonNullNode.getLocalName())
            ? SCHEMA_LOCATION : NO_NAMESPACE_SCHEMA_LOCATION;

        if (control != null) {
            controlTracker.visited(control);
        }
        if (test != null) {
            testTracker.visited(test);
        }
        
        compare(control != null ? control.getValue() : ATTRIBUTE_ABSENT,
                test != null ? test.getValue() : ATTRIBUTE_ABSENT,
                control, test, listener, d);
    }
966014
public static void assertXpathsNotEqual(String controlXpath,
                                            Document controlDocument,
                                            String testXpath,
                                            Document testDocument)
        throws XpathException {
        assertXpathEquality(controlXpath, controlDocument, testXpath,
                            testDocument, false);
    }
74461
protected boolean compareNodeBasics(Node control, Node test,
                                        DifferenceListener listener) throws DifferenceFoundException {
        controlTracker.visited(control);
        testTracker.visited(test);

        Short controlType = new Short(control.getNodeType());
        Short testType = new Short(test.getNodeType());

        boolean textAndCDATA = comparingTextAndCDATA(control.getNodeType(),
                                                     test.getNodeType());
        if (!textAndCDATA) {
            compare(controlType, testType, control, test, listener,
                    NODE_TYPE);
        }
        compare(control.getNamespaceURI(), test.getNamespaceURI(),
                control, test, listener, NAMESPACE_URI);
        compare(control.getPrefix(), test.getPrefix(),
                control, test, listener, NAMESPACE_PREFIX);
            
        return textAndCDATA || controlType.equals(testType);
    }
404000
protected void compareText(CharacterData control, CharacterData test,
                               DifferenceListener listener)
        throws DifferenceFoundException {
        compareCharacterData(control, test, listener,
                             control instanceof CDATASection ? CDATA_VALUE : TEXT_VALUE);
    }
1327616
@Override
    public int compare(final Object source, final Object target) {
        try {
            return (Integer) compareMethod.invoke(collatorInstance, source, target);
        } catch (final Exception e) {
            throw new RuntimeException(e.getMessage(), e);
        }
    }
828045
public ExpressionBuilder notEquals(final SubordinateTrigger trigger, final Object compare) {
		BooleanExpression exp = new CompareExpression(CompareType.NOT_EQUAL, trigger, compare);
		appendExpression(exp);

		return this;
	}
273921
private ComparisonState compareDocuments(final Document control,
                                             final XPathContext controlContext,
                                             final Document test,
                                             final XPathContext testContext) {
        final DocumentType controlDt = filterNode(control.getDoctype());
        final DocumentType testDt = filterNode(test.getDoctype());

        return compare(new Comparison(ComparisonType.HAS_DOCTYPE_DECLARATION,
                                      control, getXPath(controlContext),
                                      Boolean.valueOf(controlDt != null), getParentXPath(controlContext),
                                      test, getXPath(testContext),
                                      Boolean.valueOf(testDt != null), getParentXPath(testContext)))
            .andIfTrueThen(controlDt != null && testDt != null,
                           new DeferredComparison() {
                               @Override
                               public ComparisonState apply() {
                                   return compareNodes(controlDt, controlContext,
                                                       testDt, testContext);
                               }
                           })
            .andThen(compareDeclarations(control, controlContext,
                                         test, testContext));
    }
445264
@Override
    public void setAttribute(String name, Object value) {
        final boolean bTrace = TraceComponent.isAnyTracingEnabled();
        if (bTrace && tc.isDebugEnabled()) {
            Tr.debug(tc, "setAttribute: " + name + "=" + value);
        }
        if (null == value) {
            removeAttribute(name);
            return;
        }
        if (isInvalid()) {
            throw new IllegalStateException("Session is invalid");
        }
        HttpSessionBindingEvent replaceEvent = null;
        HttpSessionBindingEvent addEvent = null;
        Object current = this.attributes.remove(name);
        if (null != current) {
            replaceEvent = new HttpSessionBindingEvent(this, name, current);
            if (current instanceof HttpSessionBindingListener) {
                // inform the old value of it's removal
                if (bTrace && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Notifying old value: " + current);
                }
                ((HttpSessionBindingListener) current).valueUnbound(replaceEvent);
            }
        }
        this.attributes.put(name, value);
        if (value instanceof HttpSessionBindingListener) {
            // inform the new value of it's use
            if (bTrace && tc.isDebugEnabled()) {
                Tr.debug(tc, "Notifying new value: " + value);
            }
            addEvent = new HttpSessionBindingEvent(this, name, value);
            ((HttpSessionBindingListener) value).valueBound(addEvent);
        }
        // List<HttpSessionAttributeListener> list = this.myConfig.getSessionAttributeListeners();
        // if (null != list) {
        // // if we replaced a value, let the listeners now that. Otherwise,
        // // tell them of the new value being set
        // if (null != current) {
        // for (HttpSessionAttributeListener listener : list) {
        // if (bTrace && tc.isDebugEnabled()) {
        // Tr.debug(tc, "Notifying listener of replace: " + listener);
        // }
        // listener.attributeReplaced(replaceEvent);
        // }
        // } else {
        // if (null == addEvent) {
        // addEvent = new HttpSessionBindingEvent(this, name, value);
        // }
        // for (HttpSessionAttributeListener listener : list) {
        // if (bTrace && tc.isDebugEnabled()) {
        // Tr.debug(tc, "Notifying listener of set: " + listener);
        // }
        // listener.attributeAdded(addEvent);
        // }
        // }
        // }
    }
814247
public void skippedComparison(Node control, Node test) {
        if (differenceListenerDelegate != null) {
            differenceListenerDelegate.skippedComparison(control, test);
        } else {
            System.err.println("DifferenceListener.skippedComparison: "
                               + "unhandled control node type=" + control
                               + ", unhandled test node type=" + test);
        }
    }
186224
public static DiffBuilder compare(final Object control) {
        final Source controlSource = getSource(control);
        return new DiffBuilder(controlSource);
    }
1068928
public static Diff compareXML(String control, String test)
        throws SAXException, IOException {
        return new Diff(control, test);
    }
757327
public <T> void compare(Comparison comparison, Label trueLabel, Local<T> a, Local<T> b) {
        adopt(trueLabel);
        Rop rop = comparison.rop(StdTypeList.make(a.type.ropType, b.type.ropType));
        addInstruction(new PlainInsn(rop, sourcePosition, null,
                RegisterSpecList.make(a.spec(), b.spec())), trueLabel);
    }
1091793
private ComparisonState compareCharacterData(CharacterData control,
                                                 XPathContext controlContext,
                                                 CharacterData test,
                                                 XPathContext testContext) {
        return compare(new Comparison(ComparisonType.TEXT_VALUE, control,
                                      getXPath(controlContext),
                                      control.getData(), getParentXPath(controlContext),
                                      test, getXPath(testContext),
                                      test.getData(), getParentXPath(testContext)));
    }
902907
public Configuration withDifferenceListener(DifferenceListener differenceListener) {
        return new Configuration(tolerance, options, ignorePlaceholder, matchers, pathsToBeIgnored, differenceListener);
    }
309562
private ComparisonState compareXsiType(Attr controlAttr,
                                           XPathContext controlContext,
                                           Attr testAttr,
                                           XPathContext testContext) {
        boolean mustChangeControlContext = controlAttr != null;
        boolean mustChangeTestContext = testAttr != null;
        if (!mustChangeControlContext && !mustChangeTestContext) {
            return new OngoingComparisonState();
        }
        boolean attributePresentOnBothSides = mustChangeControlContext
            && mustChangeTestContext;

        try {
            QName controlAttrName = null;
            if (mustChangeControlContext) {
                controlAttrName = Nodes.getQName(controlAttr);
                controlContext.addAttribute(controlAttrName);
                controlContext.navigateToAttribute(controlAttrName);
            }
            QName testAttrName = null;
            if (mustChangeTestContext) {
                testAttrName = Nodes.getQName(testAttr);
                testContext.addAttribute(testAttrName);
                testContext.navigateToAttribute(testAttrName);
            }
            return
                compare(new Comparison(ComparisonType.ATTR_NAME_LOOKUP,
                                       controlAttr, getXPath(controlContext),
                                       controlAttrName, getParentXPath(controlContext),
                                       testAttr, getXPath(testContext),
                                       testAttrName, getParentXPath(testContext)))
                .andIfTrueThen(attributePresentOnBothSides,
                               compareAttributeExplicitness(controlAttr, controlContext,
                                                            testAttr, testContext))
                .andIfTrueThen(attributePresentOnBothSides,
                               new Comparison(ComparisonType.ATTR_VALUE,
                                              controlAttr, getXPath(controlContext),
                                              valueAsQName(controlAttr), getParentXPath(controlContext),
                                              testAttr, getXPath(testContext),
                                              valueAsQName(testAttr), getParentXPath(testContext)));
        } finally {
            if (mustChangeControlContext) {
                controlContext.navigateToParent();
            }
            if (mustChangeTestContext) {
                testContext.navigateToParent();
            }
        }
    }
430488
public static void assertXMLEqual(InputSource control, InputSource test)
        throws SAXException, IOException {
        assertXMLEqual(null, control, test);
    }
399216
public int compare(Attribute a, Attribute b) {
        int result = a.getId().toString().compareTo(b.getId().toString());

        if (result == 0) {
            result = a.getType().toString().compareTo(b.getType().toString());
        } else {
            return result;
        }

        if (result == 0) {
            result = a.getValue().encode().compareTo(b.getValue().encode());
        } else {
            return result;
        }

        if (result == 0
                && (a.getIssueInstant() != null || b.getIssueInstant() != null)) {
            if (a.getIssueInstant() == null && b.getIssueInstant() == null) {
                result = 0;
            } else if (a.getIssueInstant() != null
                    && b.getIssueInstant() == null) {
                result = 1;
            } else if (a.getIssueInstant() == null
                    && b.getIssueInstant() != null) {
                result = -1;
            } else {
                result =
                        a.getIssueInstant().encode().compareTo(b
                                .getIssueInstant().encode());
            }
        }

        return result;
    }