【发布时间】:2018-02-01 17:48:11
【问题描述】:
这是代码
XmlDocument xml = new XmlDocument();
XmlElement root = xml.CreateElement("customers");
xml.AppendChild(root);
foreach (var cust in customerlist)
{
XmlElement child = xml.CreateElement("customer");
child.SetAttribute("CustomerId", cust.CustomerId.ToString());
child.SetAttribute("CustomerName", cust.CustomerName);
child.SetAttribute("PhoneNumber", cust.PhoneNumber);
child.SetAttribute("Email", cust.Email);
root.AppendChild(child);
}
string s = xml.OuterXml;
我希望我的字符串添加下一行而不是单个 xml 文档
我的字符串是连续的
xxxxx xxxxx
【问题讨论】:
-
您的具体问题是什么?
-
不清楚您想做什么,请在您的意思中添加更多详细信息以“添加下一行”
-
@CamiloTerevinto 我的意思是'\n'