111,098
社区成员




//string s = "<?xml version=\"1.0\" encoding=\"gb2312\"?>";
string s = "<root><item></item></root>";
XmlDocument doc1 = new XmlDocument();
doc1.LoadXml(s);
//我手动打的
string xml = "<root><item></item></root>";
Console.WriteLine(xml.Length);// 26
XmlDocument doc = new XmlDocument();
doc.LoadXml(xml);
//复制你的
string s = "<root><item></item></root>";
Console.WriteLine(s.Length);// 27
Console.WriteLine(s[0]);// ?
Console.WriteLine(s[1]);// <
Console.WriteLine(s);// ?<root><item></item></root>
XmlDocument doc1 = new XmlDocument();
doc1.LoadXml(s);
然后我把光标放字符串上,不要放最前面..然后通过 ←键移动了到最前面,按back键,居然删了东西,字符串看起来没变化,然后一切就正常了。
应该你的字符串上面有控制字符,反正我是不知道你是怎么输入的。