Compare two DocumentType nodes
@param control
@param test
@param listener
@throws DifferenceFoundException
557059
protected void compareDocumentType(DocumentType control, DocumentType test,
                                       DifferenceListener listener) throws DifferenceFoundException {
        compare(control.getName(), test.getName(), control, test, listener,
                DOCTYPE_NAME);
        compare(control.getPublicId(), test.getPublicId(), control, test, listener,
                DOCTYPE_PUBLIC_ID);

        compare(control.getSystemId(), test.getSystemId(),
                control, test, listener, DOCTYPE_SYSTEM_ID);
    }
872489
public CompareAssert and(Object control) {
        isNotNull();
        try {
            return CompareAssert.create(actual, control, prefix2Uri, dbf);
        } catch (Exception e) {
            throwAssertionError(shouldNotHaveThrown(e));
        }
        return null; //fix compile issue
    }
966014
public static void assertXpathsNotEqual(String controlXpath,
                                            Document controlDocument,
                                            String testXpath,
                                            Document testDocument)
        throws XpathException {
        assertXpathEquality(controlXpath, controlDocument, testXpath,
                            testDocument, false);
    }
439348
public boolean compare(List<CoreLabel> doc1, List<CoreLabel> doc2) {
		int i1 = 0, i2 = 0; //
		String last1 = "O", last2 = "O";

		boolean cm_set;
	
		for (int i = 0; i < doc1.size(); i++) {
			CoreLabel c1 = doc1.get(i);
			CoreLabel c2 = doc2.get(i);
			
			String a1 = c1.getString(AnswerAnnotation.class);
			String a2 = c2.getString(AnswerAnnotation.class);
			
			if (a1 == null || a2 == null) return false;
		}
		// TODO
			
		return true;
	}
227735
function executeDiff(nodesOld, nodesNew, patches) {
	while (true) {
		const nodeOld = nodesOld.pop();
		const nodeOldNode = nodeOld.node;
		const nodeNew = nodesNew.pop();

		// If they have the same reference (hoisted) then skip diffing.
		if (nodeOldNode !== nodeNew) {
			if (nodeOldNode.name !== nodeNew.name) {
				// If they have different names, then replace the old node with the
				// new one.
				patches.push({
					type: patchTypes.replaceNode,
					nodeOld,
					nodeNew,
					nodeParent: null
				});
			} else if (nodeOldNode.type === types.text) {
				// If they both are text, then update the text content.
				if (nodeOldNode.data[""] !== nodeNew.data[""]) {
					patches.push({
						type: patchTypes.updateText,
						nodeOld,
						nodeNew,
						nodeParent: null
					});
				}
			} else {
				// If they both are normal elements, then update attributes, update
				// events, and diff the children for appends, deletes, or recursive
				// updates.
				patches.push({
					type: patchTypes.updateData,
					nodeOld,
					nodeNew,
					nodeParent: null
				});

				const childrenOld = nodeOld.children;
				const childrenNew = nodeNew.data.children;

				const childrenOldLength = childrenOld.length;
				const childrenNewLength = childrenNew.length;

				if (childrenOldLength === childrenNewLength) {
					// If the children have the same length then update both as
					// usual.
					for (let i = 0; i < childrenOldLength; i++) {
						nodesOld.push(childrenOld[i]);
						nodesNew.push(childrenNew[i]);
					}
				} else if (childrenOldLength > childrenNewLength) {
					// If there are more old children than new children, update the
					// corresponding ones and remove the extra old children.
					for (let i = 0; i < childrenNewLength; i++) {
						nodesOld.push(childrenOld[i]);
						nodesNew.push(childrenNew[i]);
					}

					for (let i = childrenNewLength; i < childrenOldLength; i++) {
						patches.push({
							type: patchTypes.removeNode,
							nodeOld: childrenOld[i],
							nodeNew: null,
							nodeParent: nodeOld
						});
					}
				} else {
					// If there are more new children than old children, update the
					// corresponding ones and append the extra new children.
					for (let i = 0; i < childrenOldLength; i++) {
						nodesOld.push(childrenOld[i]);
						nodesNew.push(childrenNew[i]);
					}

					for (let i = childrenOldLength; i < childrenNewLength; i++) {
						patches.push({
							type: patchTypes.appendNode,
							nodeOld: null,
							nodeNew: childrenNew[i],
							nodeParent: nodeOld
						});
					}
				}
			}
		}

		if (nodesOld.length === 0) {
			// Move to the patch phase if there is nothing left to do.
			executePatch(patches);

			break;
		} else if (performance.now() - executeStart >= 16) {
			// If the current frame doesn't have sufficient time left to keep
			// running then continue diffing in the next frame.
			requestAnimationFrame(() => {
				executeStart = performance.now();

				executeDiff(nodesOld, nodesNew, patches);
			});

			break;
		}
	}
}
488898
private void doDocumentTypeDefinition(Node received, Node source,
            XmlMessageValidationContext validationContext,
            NamespaceContext namespaceContext, TestContext context) {

        Assert.isTrue(source instanceof DocumentType, "Missing document type definition in expected xml fragment");

        DocumentType receivedDTD = (DocumentType) received;
        DocumentType sourceDTD = (DocumentType) source;

        if (log.isDebugEnabled()) {
            log.debug("Validating document type definition: " +
                    receivedDTD.getPublicId() + " (" + receivedDTD.getSystemId() + ")");
        }

        if (!StringUtils.hasText(sourceDTD.getPublicId())) {
            Assert.isNull(receivedDTD.getPublicId(),
                    ValidationUtils.buildValueMismatchErrorMessage("Document type public id not equal",
                    sourceDTD.getPublicId(), receivedDTD.getPublicId()));
        } else if (sourceDTD.getPublicId().trim().equals(Citrus.IGNORE_PLACEHOLDER)) {
            if (log.isDebugEnabled()) {
                log.debug("Document type public id: '" + receivedDTD.getPublicId() +
                        "' is ignored by placeholder '" + Citrus.IGNORE_PLACEHOLDER + "'");
            }
        } else {
            Assert.isTrue(StringUtils.hasText(receivedDTD.getPublicId()) &&
                    receivedDTD.getPublicId().equals(sourceDTD.getPublicId()),
                    ValidationUtils.buildValueMismatchErrorMessage("Document type public id not equal",
                    sourceDTD.getPublicId(), receivedDTD.getPublicId()));
        }

        if (!StringUtils.hasText(sourceDTD.getSystemId())) {
            Assert.isNull(receivedDTD.getSystemId(),
                    ValidationUtils.buildValueMismatchErrorMessage("Document type system id not equal",
                    sourceDTD.getSystemId(), receivedDTD.getSystemId()));
        } else if (sourceDTD.getSystemId().trim().equals(Citrus.IGNORE_PLACEHOLDER)) {
            if (log.isDebugEnabled()) {
                log.debug("Document type system id: '" + receivedDTD.getSystemId() +
                        "' is ignored by placeholder '" + Citrus.IGNORE_PLACEHOLDER + "'");
            }
        } else {
            Assert.isTrue(StringUtils.hasText(receivedDTD.getSystemId()) &&
                    receivedDTD.getSystemId().equals(sourceDTD.getSystemId()),
                    ValidationUtils.buildValueMismatchErrorMessage("Document type system id not equal",
                    sourceDTD.getSystemId(), receivedDTD.getSystemId()));
        }

        validateXmlTree(received.getNextSibling(),
                source.getNextSibling(), validationContext, namespaceContext, context);
    }
379920
@Override
    public DiffBuilder withDifferenceListeners(final ComparisonListener... comparisonListeners) {
        this.differenceListeners.addAll(Arrays.asList(comparisonListeners));
        return this;
    }
198513
public boolean compare(Document doc1, Document doc2, String tableName) {
        NodeList nl = doc1.getElementsByTagName("Row");
        for (int i = 0; i < nl.getLength(); i++) {
            Node n = nl.item(i);
            // check if the rows belongs to the table name
            Node tableNodeNameAttr = n.getParentNode().getAttributes().getNamedItem("name");
            String tableNameAttr = tableNodeNameAttr.getNodeValue();
            if (!tableNameAttr.equals(tableName)) {
                continue;
            }
            Node tableNodeKeyAttr = n.getParentNode().getAttributes().getNamedItem("key");
            String tableKeyAttr = tableNodeKeyAttr.getNodeValue();
            String[] primaryKeyFields = new String[] {tableKeyAttr};
            return compare(doc1, doc2, tableName, primaryKeyFields);

        }
        return true; // table is not to be compared (not found)
    }
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));
    }
373103
public Difference<BaseType> compareObjects(List<String> field1,
                                               ObjectType node1,
                                               List<String> field2,
                                               ObjectType node2)
            throws InvalidArrayIdentity, DuplicateArrayIdentity {
        Difference<BaseType> ret = new Difference<>();
        // Field by field comparison of obj1 to obj2. 
        for (Iterator<Map.Entry<String, BaseType>> fields = getFields(node1); fields.hasNext();) {
            Map.Entry<String, BaseType> field = fields.next();
            String fieldName = field.getKey();
            field1.add(fieldName);
            BaseType value1 = field.getValue();

            if (hasField(node2, fieldName)) {
                // If both obj1 and obj2 have the same field, compare recursively
                field2.add(fieldName);
                BaseType value2 = getField(node2, fieldName);
                ret.add(compareNodes(field1, value1, field2, value2));
                pop(field2);
            } else {
                // obj1.field1 exists, obj2.field1 does not, so it is removed
                ret.add(new Removal(field1, value1));
            }
            pop(field1);
        }
        // Now compare any new nodes added to obj2
        for (Iterator<Map.Entry<String, BaseType>> fields = getFields(node2); fields.hasNext();) {
            Map.Entry<String, BaseType> field = fields.next();
            String fieldName = field.getKey();
            if (!hasField(node1, fieldName)) {
                field2.add(fieldName);
                ret.add(new Addition(field2, field.getValue()));
                pop(field2);
            }
        }
        return ret;
    }
291163
public static void assertXMLEqual(String control, String test)
        throws SAXException, IOException {
        assertXMLEqual(null, control, test);
    }
565747
private void visitComplexTypeWithDiff(final ObjectGraphNode node, final Object otherInstance) {
		if (otherInstance == null) {
			// Nothing to compare against, just use the default visit
			visitComplexType(node);
		} else {
			Field[] fields = getAllInstanceFields(node.getValue());

			for (int i = 0; i < fields.length; i++) {
				Object fieldValue = readField(fields[i], node.getValue());
				Object otherValue = readField(fields[i], otherInstance);
				String fieldType = fields[i].getType().getName();
				String nodeFieldName = fields[i].getName() + (Util.equals(fieldValue, otherValue) ? "" : "*");

				ObjectGraphNode childNode = new ObjectGraphNode(++nodeCount, nodeFieldName,
						fieldType, fieldValue);
				node.add(childNode);
				visit(childNode);
			}
		}
	}
595912
public int differenceFound(Difference difference) {
        final int returnValue = super.differenceFound(difference);
        switch (returnValue) {
        case RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL:
            return returnValue;
        case RETURN_ACCEPT_DIFFERENCE:
            break;
        case RETURN_IGNORE_DIFFERENCE_NODES_SIMILAR:
            difference.setRecoverable(true);
            break;
        case RETURN_UPGRADE_DIFFERENCE_NODES_DIFFERENT:
            difference.setRecoverable(false);
            break;
        default:
            throw new IllegalArgumentException(returnValue
                                               + " is not a defined "
                                               + " DifferenceListener"
                                               + ".RETURN_... value");
        }
        allDifferences.add(difference);
        return returnValue;
    }
166758
public static void assertXpathValuesEqual(String controlXpath,
                                              String testXpath,
                                              Document document)
        throws XpathException {
        assertXpathValuesEqual(controlXpath, document, testXpath, document);
    }
247349
private ComparisonState compareAttributes(Attr control,
                                              XPathContext controlContext,
                                              Attr test,
                                              XPathContext testContext) {
        return compareAttributeExplicitness(control, controlContext, test,
                                            testContext).apply()
            .andThen(new Comparison(ComparisonType.ATTR_VALUE,
                                    control, getXPath(controlContext),
                                    control.getValue(), getParentXPath(controlContext),
                                    test, getXPath(testContext),
                                    test.getValue(), getParentXPath(testContext)));
    }
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();
            }
        }
    }
1278162
public static void assertXMLNotEqual(String err, Reader control, Reader test)
        throws SAXException, IOException {
        Diff diff = new Diff(control, test);
        assertXMLEqual(err, diff, false);
    }