if (length != length2) { throw new XMLRuntimeException("nodes hava a different number of attributes");
if (name.equals(name2) && value.equals(value2)) { continue outer; }
   public static void assertEquivalent(Node node, Node node2)   {      if (node == null)      {         throw new XMLRuntimeException("the first node to be compared is null");      }      if (node2 == null)      {         throw new XMLRuntimeException("the second node to be compared is null");      }      if (!node.getNodeName().equals(node2.getNodeName()))      {         throw new XMLRuntimeException("nodes have different node names");      }      boolean hasAttributes = node.hasAttributes();      if (hasAttributes != node2.hasAttributes())      {         throw new XMLRuntimeException("one node has attributes and the other doesn't");      }      if (hasAttributes)      {         NamedNodeMap attrs = node.getAttributes();         int length = attrs.getLength();         NamedNodeMap attrs2 = node2.getAttributes();         int length2 = attrs2.getLength();         if (length != length2)         {            throw new XMLRuntimeException("nodes hava a different number of attributes");         }         outer: for(int i = 0; i < length; i++)         {            Node n = attrs.item(i);            String name = n.getNodeName();            String value = n.getNodeValue();            for(int j = 0; j < length; j++)            {               Node n2 = attrs2.item(j);               String name2 = n2.getNodeName();               String value2 = n2.getNodeValue();               if (name.equals(name2) && value.equals(value2))               {                  continue outer;               }            }            throw new XMLRuntimeException("attribute " + name + "=" + value + " doesn't match");         }      }      boolean hasChildren = node.hasChildNodes();      if (hasChildren != node2.hasChildNodes())      {         throw new XMLRuntimeException("one node has children and the other doesn't");      }      if (hasChildren)      {         NodeList nl = node.getChildNodes();         NodeList nl2 = node2.getChildNodes();         short[] toFilter = new short[] {Node.TEXT_NODE, Node.ATTRIBUTE_NODE, Node.COMMENT_NODE};         List nodes = filter(nl, toFilter);         List nodes2 = filter(nl2, toFilter);         int length = nodes.size();         if (length != nodes2.size())         {            throw new XMLRuntimeException("nodes hava a different number of children");         }         for(int i = 0; i < length; i++)         {            Node n = (Node)nodes.get(i);            Node n2 = (Node)nodes2.get(i);            assertEquivalent(n, n2);         }      }   }