XDocument xdoc = XDocument.Load(@"C:\Users\xmlformatı.txt");
XmlDocument doc = new XmlDocument();
doc.Load(@"C:\Users\xmlformatı.txt");
XmlNodeList xmlList = doc.SelectNodes("//*");
foreach (XElement element in xdoc.Descendants())
{
foreach (XmlNode xn in xmlList)
{
string sa = xn.Name;
string neww = "fat:" + xn.Name;
string last = sa.Replace(sa, neww);
element.Name = last;
\\file writing things
doc.Save(@"C:\Users\denemexml.txt");
}
}
但是我得到了例外:名称中不能包含':'字符,十六进制值0x3A。'