1。XMLFile.xml:
<?xml version="1.0" encoding="utf-8" ?>
<Resource>
<Add Key="area_house" Value ="基地情況表(住宅及居民)"/>
<Add Key="asset" Value ="固定資產狀況表"/>
<Add Key="cost" Value ="成本費用情況表"/>
<Add Key="energy_supply" Value ="基地情況表(能源供應)"/>
<Add Key="facilities" Value ="基地情況表(服務設施表)"/>
<Add Key="housing_service" Value ="房屋維修基金情況表"/>
<Add Key="income" Value ="收入情況表"/>
<Add Key="interior_charge" Value ="內部各業務互供服務收費情況表"/>
<Add Key="investment" Value ="礦區建設投資情況表"/>
<Add Key="organizations" Value ="組織機構情況表"/>
<Add Key="price" Value ="價格表"/>
<Add Key="profit" Value ="內部利潤表"/>
<Add Key="square" Value ="基地情況表(佔地及位置)"/>
<Add Key="workload" Value ="基地情況表(實物工作量)"/>
<Add Key="employee" Value ="人員基本情況表"/>
</Resource>
2。C#:
XmlDocument doc = new XmlDocument();
doc.Load(Server.MapPath("XMLFile.xml"));
//取得你要的Resouce node的子節點
XmlNodeList nodes = doc.SelectSingleNode("Resource").ChildNodes;
//讀取
foreach (XmlNode node in nodes) {
Response.Write("Key:" + node.Attributes["Key"].Value + ",Value:" + node.Attributes["Value"].Value + "<br>");
}