本文整理匯總了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);
}