/** * Tests whether a Node has children, taking ignoreComments * setting into account. */ private Boolean hasChildNodes(Node n) { boolean flag = n.hasChildNodes(); if (flag && XMLUnit.getIgnoreComments()) { List nl = nodeList2List(n.getChildNodes()); flag = !nl.isEmpty(); } return flag ? Boolean.TRUE : Boolean.FALSE; }
/** * Compare the contents of two node list one by one, assuming that order * of children is NOT important: matching begins at same position in test * list as control list. * @param control * @param test * @param numNodes convenience parameter because the calling method should * know the value already * @param listener * @param elementQualifier used to determine which of the child elements in * the test NodeList should be compared to the current child element in the * control NodeList. * @throws DifferenceFoundException * @deprecated Use the version with List arguments instead */ protected void compareNodeList(final NodeList control, final NodeList test, final int numNodes, final DifferenceListener listener, final ElementQualifier elementQualifier) throws DifferenceFoundException { compareNodeList(nodeList2List(control), nodeList2List(test), numNodes, listener, elementQualifier); }
/** * Tests whether a Node has children, taking ignoreComments * setting into account. */ private Boolean hasChildNodes(Node n) { boolean flag = n.hasChildNodes(); if (flag && XMLUnit.getIgnoreComments()) { List nl = nodeList2List(n.getChildNodes()); flag = !nl.isEmpty(); } return flag ? Boolean.TRUE : Boolean.FALSE; }
/** * Compare the number of children, and if the same, compare the actual * children via their NodeLists. * @param control * @param test * @param listener * @param elementQualifier * @throws DifferenceFoundException */ protected void compareNodeChildren(Node control, Node test, DifferenceListener listener, ElementQualifier elementQualifier) throws DifferenceFoundException { if (control.hasChildNodes() && test.hasChildNodes()) { List controlChildren = nodeList2List(control.getChildNodes()); List testChildren = nodeList2List(test.getChildNodes()); Integer controlLength = new Integer(controlChildren.size()); Integer testLength = new Integer(testChildren.size()); compare(controlLength, testLength, control, test, listener, CHILD_NODELIST_LENGTH); compareNodeList(controlChildren, testChildren, controlLength.intValue(), listener, elementQualifier); } }
throws DifferenceFoundException { List<Node> controlChildren = nodeList2List(control.getChildNodes()); List<Node> testChildren = nodeList2List(test.getChildNodes());