private static void CheckForDuplicateNodes(XmlNode node, XmlNode root) { XmlInheritance.tempUsedNodeNames.Clear(); foreach (XmlNode xmlNode in node.ChildNodes) { if (xmlNode.NodeType == XmlNodeType.Element && !(xmlNode.Name == "li")) { if (XmlInheritance.tempUsedNodeNames.Contains(xmlNode.Name)) { Log.Error(string.Concat(new string[] { "XML error: Duplicate XML node name ", xmlNode.Name, " in this XML block: ", node.OuterXml, (node == root) ? string.Empty : ("\n\nRoot node: " + root.OuterXml) }), false); } else { XmlInheritance.tempUsedNodeNames.Add(xmlNode.Name); } } } XmlInheritance.tempUsedNodeNames.Clear(); foreach (XmlNode xmlNode2 in node.ChildNodes) { if (xmlNode2.NodeType == XmlNodeType.Element) { XmlInheritance.CheckForDuplicateNodes(xmlNode2, root); } } }
private static void ResolveXmlNodeFor(XmlInheritance.XmlInheritanceNode node) { if (node.parent == null) { node.resolvedXmlNode = node.xmlNode; return; } if (node.parent.resolvedXmlNode == null) { Log.Error("XML error: Internal error. Tried to resolve node whose parent has not been resolved yet. This means that this method was called in incorrect order."); node.resolvedXmlNode = node.xmlNode; return; } XmlInheritance.CheckForDuplicateNodes(node.xmlNode); XmlNode xmlNode = node.parent.resolvedXmlNode.CloneNode(true); xmlNode.Attributes.RemoveAll(); XmlAttributeCollection attributes = node.xmlNode.Attributes; for (int i = 0; i < attributes.Count; i++) { if (!(attributes[i].Name == XmlInheritance.NameAttributeName) && !(attributes[i].Name == XmlInheritance.ParentNameAttributeName)) { XmlAttribute node2 = (XmlAttribute)xmlNode.OwnerDocument.ImportNode(attributes[i], true); xmlNode.Attributes.Append(node2); } } XmlAttributeCollection attributes2 = node.parent.resolvedXmlNode.Attributes; for (int j = 0; j < attributes2.Count; j++) { if (!(attributes2[j].Name == XmlInheritance.NameAttributeName) && !(attributes2[j].Name == XmlInheritance.ParentNameAttributeName)) { if (xmlNode.Attributes[attributes2[j].Name] == null) { XmlAttribute node3 = (XmlAttribute)xmlNode.OwnerDocument.ImportNode(attributes2[j], true); xmlNode.Attributes.Append(node3); } } } XmlInheritance.RecursiveNodeCopyOverwriteElements(node.xmlNode, xmlNode); node.resolvedXmlNode = xmlNode; }
private static void ResolveXmlNodeFor(XmlInheritance.XmlInheritanceNode node) { if (node.parent == null) { node.resolvedXmlNode = node.xmlNode; return; } if (node.parent.resolvedXmlNode == null) { Log.Error("XML error: Internal error. Tried to resolve node whose parent has not been resolved yet. This means that this method was called in incorrect order.", false); node.resolvedXmlNode = node.xmlNode; return; } XmlInheritance.CheckForDuplicateNodes(node.xmlNode, node.xmlNode); XmlNode xmlNode = node.parent.resolvedXmlNode.CloneNode(true); XmlInheritance.RecursiveNodeCopyOverwriteElements(node.xmlNode, xmlNode); node.resolvedXmlNode = xmlNode; }
private static void CheckForDuplicateNodes(XmlNode node, XmlNode root) { XmlInheritance.tempUsedNodeNames.Clear(); IEnumerator enumerator = node.ChildNodes.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; XmlNode xmlNode = (XmlNode)obj; if (xmlNode.NodeType == XmlNodeType.Element && !(xmlNode.Name == "li")) { if (XmlInheritance.tempUsedNodeNames.Contains(xmlNode.Name)) { Log.Error(string.Concat(new string[] { "XML error: Duplicate XML node name ", xmlNode.Name, " in this XML block: ", node.OuterXml, (node == root) ? string.Empty : ("\n\nRoot node: " + root.OuterXml) }), false); } else { XmlInheritance.tempUsedNodeNames.Add(xmlNode.Name); } } } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } XmlInheritance.tempUsedNodeNames.Clear(); IEnumerator enumerator2 = node.ChildNodes.GetEnumerator(); try { while (enumerator2.MoveNext()) { object obj2 = enumerator2.Current; XmlNode xmlNode2 = (XmlNode)obj2; if (xmlNode2.NodeType == XmlNodeType.Element) { XmlInheritance.CheckForDuplicateNodes(xmlNode2, root); } } } finally { IDisposable disposable2; if ((disposable2 = (enumerator2 as IDisposable)) != null) { disposable2.Dispose(); } } }