protected override void WriteCommentImpl(string comment) { if (!string.IsNullOrEmpty(comment)) { Cursor.AppendChild(Document.CreateComment(comment)); } }
protected override void AppendElement(XmlElement e) { // if there is a node in scope, add the element after it and use it as the new scope if (Cursor != null) { Cursor.AppendChild(e); } else // if there is no XML node in scope, assume we're adding to the root { Document.AppendChild(e); } }
protected override void NestElement(XmlElement e, out XmlElement oldCursor) { oldCursor = null; if (Cursor != null) { Cursor.AppendChild(e); oldCursor = Cursor; Cursor = e; } else // if there is no XML node in scope, assume we're adding to the root { Document.DocumentElement.AppendChild(e); Cursor = e; } }