Removing version from xml file

前端 未结 3 1827
醉话见心
醉话见心 2020-12-19 00:13

I am creating a Xml like format using XmlWriter. But in the output there is version information also.



        
3条回答
  •  心在旅途
    2020-12-19 00:28

    When creating your XmlWriter, pass through the settings you want using XmlWriterSettings:

    XmlWriterSettings settings = new XmlWriterSettings();
    settings.OmitXmlDeclaration = true;
    
    writer = XmlWriter.Create(Console.Out, settings);
    

    XmlWriterSettings has other properties as well (indent and more).

提交回复
热议问题