您好我正在尝试将 xml 保存到文件中,并且它不断在文件开头添加不同的字符。
我的代码是
string strCXML2;
strCXML2 = "<input type=" + "\"" + "hidden" + "\"" + " name=" + "\"" + "cxml-urlencoded" + "\"" + " value=" + "\"";
strCXML2 = strCXML2 + "<!DOCTYPE cXML SYSTEM " + "\"" + "http://xml.cxml.org/schemas/cXML/1.2.023/cXML.dtd" + "\"" + ">";
//<snip>
BinaryWriter bw5 = new BinaryWriter(File.Open(Server.MapPath("~/data/test/test19.xml"), FileMode.OpenOrCreate))
bw5.Write(strCXML2);
bw5.Close();
每次它是其他一些垃圾字符时,都会在开始时返回以下 xml“}”中的文件
}<input type="hidden" name="cxml-urlencoded" value="<!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.023/cXML.dtd">
有什么想法为什么要这样做?