/// <summary> /// Creates a complete copy of the current node. /// </summary> /// <param name="deep">has child nodes</param> /// <returns>A copy of the current node</returns> internal override XmlDiffViewNode Clone(bool deep) { XmlDiffViewElement newElement = new XmlDiffViewElement( this.LocalName, this.Prefix, this.NamespaceUri, this.ignorePrefixes); // attributes { XmlDiffViewAttribute curAttr = this.Attributes; XmlDiffViewAttribute lastNewAtt = null; while (curAttr != null) { XmlDiffViewAttribute newAttr = (XmlDiffViewAttribute)curAttr.Clone(true); newElement.InsertAttributeAfter(newAttr, lastNewAtt); lastNewAtt = newAttr; curAttr = (XmlDiffViewAttribute)curAttr.NextSibbling; } } if (!deep) { return(newElement); } // child nodes { XmlDiffViewNode curChild = ChildNodes; XmlDiffViewNode lastNewChild = null; while (curChild != null) { XmlDiffViewNode newChild = curChild.Clone(true); newElement.InsertChildAfter(newChild, lastNewChild, false); lastNewChild = newChild; curChild = curChild.NextSibbling; } } return(newElement); }
internal override XmlDiffViewNode Clone(bool bDeep) { XmlDiffViewElement newElement = new XmlDiffViewElement(_localName, _prefix, _ns, _ignorePrefixes); // attributes { XmlDiffViewAttribute curAttr = _attributes; XmlDiffViewAttribute lastNewAtt = null; while (curAttr != null) { XmlDiffViewAttribute newAttr = (XmlDiffViewAttribute)curAttr.Clone(true); newElement.InsertAttributeAfter(newAttr, lastNewAtt); lastNewAtt = newAttr; curAttr = (XmlDiffViewAttribute)curAttr._nextSibbling; } } if (!bDeep) { return(newElement); } // child nodes { XmlDiffViewNode curChild = _childNodes; XmlDiffViewNode lastNewChild = null; while (curChild != null) { XmlDiffViewNode newChild = curChild.Clone(true); newElement.InsertChildAfter(newChild, lastNewChild, false); lastNewChild = newChild; curChild = curChild._nextSibbling; } } return(newElement); }