Creating XmlTextWriter with Formatting.Indented, and Settings.OmitXmlDeclaration=true

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi!
I want to create a XmlTextWriter object which I can pass to the XmlDocument.Save() method. In the XmlTextWriter class, I want
Formatting = Formatting.Indented, and
Settings.OmitXmlDeclaration = true.
 
im not able to find a way to do both. If i do:
 
XmlTextWriter x = new XmlTextWriter(), then I see that x.Settings == null, and plus its readonly.
if i do:
x = XmlTextWriter.Create(stream,settings), then "x" is not a XmlTextWriter, but some other class which does not have the Formatting property
 
Im hoping someone here can help me .. Ive been trying for 2 hours with all possible combinations .. and this is getting really frustrating !!
 
Thanks.

View the full article
 
Back
Top