/// <summary> /// Formats the token sequence to the writer /// </summary> /// <param name="writer"></param> /// <param name="tokens"></param> public void Format(IEnumerable <Token <MarkupTokenType> > tokens, TextWriter writer) { if (writer == null) { throw new ArgumentNullException("writer"); } XmlWriterAdapter adapter = writer as XmlWriterAdapter; if (adapter != null) { this.Format(adapter.Writer, tokens); return; } using (System.Xml.XmlWriter xmlWriter = System.Xml.XmlWriter.Create( writer, new XmlWriterSettings { CheckCharacters = false, ConformanceLevel = System.Xml.ConformanceLevel.Auto, Encoding = Encoding.UTF8, Indent = this.Settings.PrettyPrint, IndentChars = this.Settings.Tab, NewLineChars = this.Settings.NewLine, NewLineHandling = System.Xml.NewLineHandling.None, OmitXmlDeclaration = true })) { this.Format(xmlWriter, tokens); } }
internal override void BeginWrite(Stream input) => writer = new XmlWriterAdapter(input);