我正在创建一个 xml 架构
<?xml version="1.0" encoding="UTF-8"?>
<string xmlns="http://tempuri.org/">
<Inventories>
<ID> </ID>
<Category> </Category>
<Identity> </Identity>
<Name> </Name>
</Inventories>
</string>
使用以下代码
resultList = remoteWeb.Lists.GetByTitle("Server");
context.Load(resultList);
context.ExecuteQuery();
items = resultList.GetItems(new CamlQuery());
context.Load(items);
context.ExecuteQuery();
foreach (ListItem item in items)
{
rootNode.AppendChild(doc.CreateElement("ID")).InnerText = "pcat:401820";
rootNode.AppendChild(doc.CreateElement("Category")).InnerText = "Infrastructure.Server";
rootNode.AppendChild(doc.CreateElement("Identity")).InnerText = Convert.ToString(item["ID"]);
rootNode.AppendChild(doc.CreateElement("Name")).InnerText = Convert.ToString(item["Server_Name"]) + " >> " + Convert.ToString(item["Computer_Name"]) + " >> " + Convert.ToString(item["IP"]);
}
但是我们需要将xml设置为
<?xml version="1.0" encoding="UTF-8"?>
<string xmlns="http://tempuri.org/">
<Inventories>
<Inventory>
<ID> </ID>
<Category> </Category>
<Identity> </Identity>
<Name> </Name>
</Inventory>
</Inventories>
但没有弄清楚如何在下添加容器节点
所有帮助将不胜感激,并在此先感谢