internal static int OrderSubTrees(XmlDiffElement elem1, XmlDiffElement elem2) { var node1_1 = elem1._attributes; var node2_1 = elem2._attributes; while (node1_1 != null && node1_1.NodeType == XmlDiffNodeType.Namespace) node1_1 = (XmlDiffAttributeOrNamespace) node1_1._nextSibling; while (node2_1 != null && node2_1.NodeType == XmlDiffNodeType.Namespace) node2_1 = (XmlDiffAttributeOrNamespace) node2_1._nextSibling; for (; node1_1 != null && node2_1 != null; node2_1 = (XmlDiffAttributeOrNamespace) node2_1._nextSibling) { int num; if ((num = XmlDiffDocument.OrderAttributesOrNamespaces(node1_1, node2_1)) != 0) return num; node1_1 = (XmlDiffAttributeOrNamespace) node1_1._nextSibling; } if (node1_1 == node2_1) { var node1_2 = elem1.FirstChildNode; XmlDiffNode node2_2; for (node2_2 = elem2.FirstChildNode; node1_2 != null && node2_2 != null; node2_2 = node2_2._nextSibling) { int num; if ((num = XmlDiffDocument.OrderChildren(node1_2, node2_2)) != 0) return num; node1_2 = node1_2._nextSibling; } if (node1_2 == node2_2) return 0; return node1_2 == null ? 1 : -1; } return node1_1 == null ? 1 : -1; }
private void InsertChild(XmlDiffParentNode parent, XmlDiffNode newChild) { if (this._XmlDiff.IgnoreChildOrder) { var node1 = parent.FirstChildNode; var childNode = (XmlDiffNode) null; for (; node1 != null && XmlDiffDocument.OrderChildren(node1, newChild) <= 0; node1 = node1._nextSibling) childNode = node1; parent.InsertChildNodeAfter(childNode, newChild); } else { parent.InsertChildNodeAfter(this._curLastChild, newChild); this._curLastChild = newChild; } }