Beispiel #1
0
        public override string Convert(IDocumentNode node)
        {
            string result;

            using (_mainWriter = new StringWriter())
            {
                node.Accept(this);
                result = _mainWriter.ToString();
            }
            _mainWriter = null;

            return(result);
        }
        protected void Aggregate(IEnumerable <IDocumentNode> nodes, Func <IDocumentNode, int, string> afterEach)
        {
            int i = 0;

            using (IEnumerator <IDocumentNode> enumerator = nodes.GetEnumerator())
                while (enumerator.MoveNext())
                {
                    IDocumentNode node = enumerator.Current;

                    node?.Accept(this);
                    Writer.Write(afterEach(node, i));
                    i++;
                }
        }
 protected void Write(IDocumentNode node)
 {
     node.Accept(this);
 }
Beispiel #4
0
 public void Convert(IDocumentNode node, Stream stream)
 {
     using (_mainWriter = new StreamWriter(stream))
         node.Accept(this);
     _mainWriter = null;
 }