コード例 #1
0
        public static string ToString(XDocument doc)
        {
            var sb = new StringBuilder();

            using (var textWriter = new VeryStrangeWriterWrapper(new StringWriter(sb)))
                using (var xmlWriter = new XmlTextWriter(textWriter))
                {
                    var elementWriter = new ElementWriter(xmlWriter, textWriter);
                    elementWriter.WriteElement(doc.Root);
                }
            return(sb.ToString());
        }
コード例 #2
0
 public ElementWriter(XmlWriter writer, VeryStrangeWriterWrapper textWriter)
 {
     _writer     = writer;
     _textWriter = textWriter;
     _resolver   = new NamespaceResolver();
 }