How to avoid avoid linebreaks and spaces for XmlWellFormedWriter
- by user302670
Hi,
i am getting an XmlWriter of the AppendChild() method of a xPathNavigator.
using (XmlWriter writer = xPathNavigator.AppendChild())
{
writer.WriteStartAttribute("name");
writer.WriteEndElement();
}
The AppendChild() method returns a instance of XmlWellFormedWriter. I want to avoid linebreaks and spaces in my output xml. But the XmlWriterSettings are readonly and using an wrapper does not help anything. I tried this, but the setting of nether the wrapper nor the writer changes:
XmlWriterSettings settings = new XmlWriterSettings();
settings.IndentChars = "";
settings.NewLineChars = "";
using (XmlWriter wrapper = xPathNavigator.AppendChild())
{
XmlWriter writer = XmlWriter.Create(writer, settings);
writer.WriteStartAttribute("name");
writer.WriteEndElement();
}
Does anybody has an idea what todo?
Thanks!