最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

讀寫xml文件的2個(gè)小函數(shù)

 更新時(shí)間:2006年12月22日 00:00:00   作者:  
要利用DOM 來(lái)存取XML 文件,你必須將XML 文件連結(jié)到HTML 網(wǎng)頁(yè)上。

#region 讀寫xml文件的2個(gè)小函數(shù),2005 4 2 by hyc 
public void SetXmlFileValue(string xmlPath,string AppKey,string AppValue)//寫xmlPath是文件路徑+文件名,AppKey是 Key Name,AppValue是Value
{
XmlDocument xDoc = new XmlDocument();
xDoc.Load(xmlPath);
XmlNode xNode;
XmlElement xElem1;
XmlElement xElem2;

xNode = xDoc.SelectSingleNode("http://appSettings");

xElem1 = (XmlElement)xNode.SelectSingleNode("http://add[@key='" + AppKey + "']");
if ( xElem1 != null )
{
xElem1.SetAttribute("value",AppValue);
}
else
{
xElem2 = xDoc.CreateElement("add");
xElem2.SetAttribute("key",AppKey);
xElem2.SetAttribute("value",AppValue);
xNode.AppendChild(xElem2);
}
xDoc.Save(xmlPath);
}


public void GetXmlFileValue(string xmlPath,string AppKey,ref string AppValue)//讀xmlPath是文件路徑+文件名,AppKey是 Key Name,AppValue是Value
{
XmlDocument xDoc = new XmlDocument();
xDoc.Load(xmlPath);
XmlNode xNode;
XmlElement xElem1;

xNode = xDoc.SelectSingleNode("http://appSettings");

xElem1 = (XmlElement)xNode.SelectSingleNode("http://add[@key='" + AppKey + "']");
if ( xElem1 != null )
{
AppValue=xElem1.GetAttribute ("value");
}
else
{
// MessageBox.Show ("There is not any information!");
}

}

#endregion

相關(guān)文章

最新評(píng)論

平潭县| 绥江县| 郧西县| 洪泽县| 海城市| 武夷山市| 通榆县| 宁波市| 西畴县| 青冈县| 平罗县| 乌拉特后旗| 漳州市| 舞钢市| 舒城县| 平江县| 嵩明县| 聂荣县| 西充县| 重庆市| 镇坪县| 喜德县| 政和县| 依兰县| 武乡县| 桑日县| 宁都县| 区。| 辰溪县| 云和县| 乌海市| 壤塘县| 泊头市| 黄平县| 罗源县| 大英县| 永修县| 古浪县| 沂源县| 特克斯县| 麻栗坡县|