protected override void ReplaceRoot(ITextNode element) { var node = element as ImmutableBranchNode; if (node != null) { if (!ReferenceEquals(node.Document, this)) { throw new ArgumentException("Not one of my nodes"); } if (node.Parent != null) { throw new ArgumentException("Not a root node"); } rootNode = node; } else { throw new ArgumentException("This document does not allow nested elements."); } }
public PlainTextDocument() : base(new StringDocumentContent()) { rootNode = new ImmutableBranchNode(this); rules = new TextProcessingRules(); }