本文整理汇总了C#中System.Xml.Linq.XNode.CloneNode方法的典型用法代码示例。如果您正苦于以下问题:C# XNode.CloneNode方法的具体用法?C# XNode.CloneNode怎么用?C# XNode.CloneNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.Linq.XNode
的用法示例。
在下文中一共展示了XNode.CloneNode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddNode
private void AddNode(XNode n)
{
_parent.ValidateNode(n, _previous);
if (n.parent != null)
{
n = n.CloneNode();
}
else
{
XNode p = _parent;
while (p.parent != null) p = p.parent;
if (n == p) n = n.CloneNode();
}
_parent.ConvertTextToNode();
if (_text != null)
{
if (_text.Length > 0)
{
XText prevXText = _previous as XText;
if (prevXText != null && !(_previous is XCData))
{
prevXText.Value += _text;
}
else
{
InsertNode(new XText(_text));
}
}
_text = null;
}
InsertNode(n);
}
示例2: AddNodeSkipNotify
internal void AddNodeSkipNotify(XNode n)
{
ValidateNode(n, this);
if (n.parent != null)
{
n = n.CloneNode();
}
else
{
XNode p = this;
while (p.parent != null) p = p.parent;
if (n == p) n = n.CloneNode();
}
ConvertTextToNode();
AppendNodeSkipNotify(n);
}
示例3: AddNode
private void AddNode(XNode n)
{
this.parent.ValidateNode(n, this.previous);
if (n.parent != null)
{
n = n.CloneNode();
}
else
{
XNode parent = this.parent;
while (parent.parent != null)
{
parent = parent.parent;
}
if (n == parent)
{
n = n.CloneNode();
}
}
this.parent.ConvertTextToNode();
if (this.text != null)
{
if (this.text.Length > 0)
{
if ((this.previous is XText) && !(this.previous is XCData))
{
XText previous = (XText) this.previous;
previous.Value = previous.Value + this.text;
}
else
{
this.InsertNode(new XText(this.text));
}
}
this.text = null;
}
this.InsertNode(n);
}
示例4: AddNodeSkipNotify
internal void AddNodeSkipNotify(XNode n)
{
this.ValidateNode(n, this);
if (n.parent != null)
{
n = n.CloneNode();
}
else
{
XNode parent = this;
while (parent.parent != null)
{
parent = parent.parent;
}
if (n == parent)
{
n = n.CloneNode();
}
}
this.ConvertTextToNode();
this.AppendNodeSkipNotify(n);
}