Beispiel #1
0
        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.");
            }
        }
Beispiel #2
0
 public PlainTextDocument() : base(new StringDocumentContent())
 {
     rootNode = new ImmutableBranchNode(this);
     rules    = new TextProcessingRules();
 }