C# creating XML output file without <?xml version=“1.0” encoding=“utf-8”?>

后端 未结 2 1888
既然无缘
既然无缘 2021-01-04 10:51

I\'m new to C# development so maybe a very simple question here.

I\'m trying to get an output which starts as this:

    

        
相关标签:
2条回答
  • 2021-01-04 11:19
     private string RemoveXmlDefinition(string xml)
     {
        XDocument xdoc = XDocument.Parse(xml);
        xdoc.Declaration = null;
    
        return xdoc.ToString();
     }
    
    0 讨论(0)
  • 2021-01-04 11:35
    XmlWriterSettings settings = new XmlWriterSettings();
    settings.OmitXmlDeclaration = true;
    
    0 讨论(0)
提交回复
热议问题