XmlNodeList node = DOC.GetElementsByTagName("CheckMarkObject");
foreach (XmlNode nodes in node)
{
string name = null;
name = node.innertext;
}
checkmark.Label = node[0].InnerText;
checkmark.Name = node[0].InnerText;
//checkmark.IsChecked = form[0].InnerText;
CreateControlsUsingObjects(checkmark);
答案 0 :(得分:1)
变量名称应该是其他方式
XmlNodeList nodes = DOC.GetElementsByTagName("CheckMarkObject");
foreach (XmlNode node in nodes)
{
string name = node.InnerText;
}
//using System.Data;
public DataTable getNodesData(XmlNodeList nodes)
{
DataTable dt = new DataTable();
if (nodes.Count <= 0)
return dt;
foreach (XmlNode childnode in nodes[0].ChildNodes)
dt.Columns.Add(childnode.Name);
foreach (XmlNode node in nodes)
{
DataRow dr = dt.NewRow();
foreach (XmlNode childnode in node.ChildNodes)
dr[childnode.Name] = childnode.InnerText;
dt.Rows.Add(dr);
}
return dt;
}
XmlNodeList nodes = DOC.GetElementsByTagName("CheckMarkObject");
DataTable dt = getNodesData(nodes);
//Bind your dt to GridView, DataList, Repeater etc
或
foreach(DataRow row in dt.Rows)
{
print(row["Name"]);
print(row["IsChecked"]);
print(row["Label"]);
}