hi.
i am generating an xml file using XDocument. when i save this file it adds
<?xml version="1.0" encoding="utf-8"?>
at the top of xml..
i want to exclude this before saving
how can i do that.
hi.
i am generating an xml file using XDocument. when i save this file it adds
<?xml version="1.0" encoding="utf-8"?>
at the top of xml..
i want to exclude this before saving
how can i do that.
Using the save method to a XmlWriter http://msdn.microsoft.com/en-us/library/bb336977.aspx, and creating this XmlWiter with XmlWriterSettings http://msdn.microsoft.com/en-us/library/system.xml.xmlwriter.settings.aspx
XmlWriterSettings settings = new XmlWriterSettings();
settings.OmitXmlDeclaration = true;
XmlWriter writer = XmlWriter.Create(yourstream, settings);
yourXDocument.Save(writer);