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); }
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) { if (previous is XText && !(previous is XCData)) { ((XText)previous).Value += text; } else { InsertNode(new XText(text)); } } text = null; } InsertNode(n); }