Thank you, I completely missed the version that took a reader.
I am seeing some other strangeness with this code:
XmlReader reader = XmlReader.Create( streamContent );
reader.MoveToContent();
StringBuilder sb = new StringBuilder();
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
settings.IndentChars = ("\t");
settings.Encoding = System.Text.Encoding.UTF8;
XmlWriter writer = XmlWriter.Create( sb, settings );
writer.WriteNode( reader, true );
writer.Close();
I specifically set the encoding to be UTF-8 and to indent the content, but
the header comes out as UTF-16 encoding and none of the contenet is tabbed.
If I set settings.NewLineOnAttributes = true, it does put attributes on a
new line.
Am I again missing something simple?
Michael
[quoted text, click to view] "Oleg Tkachenko" <oleg@!no!spam!please!tkachenko.com> wrote in message
news:%23oYOQwMpFHA.3244@TK2MSFTNGP09.phx.gbl...
> Michael Malinak wrote:
>> Since XmlWriter offers so many nice options for formatting, I thought it
>> would be nice to read in via XmlReader, and write back out via XmlWriter.
>> It might be overkill, but I'd also like to be able to check some values
>> during that time also so I was going to be using XmlReader anyway.
>> Unfortunately I don't see an easy way to stream it back out through
>> XmlWriter without going node by node.
>
> You missed XmlWriter.WriteNode() method.
>
> --
> Oleg Tkachenko [XML MVP, MCAD]
>
http://www.xmllab.net >
http://blog.tkachenko.com