System.Xml.XmlDocument xdoc=new System.Xml.XmlDocument();
xdoc.Load(@"D:\Documents and Settings\Cym\桌面\1.xml");
string x,y,srcmsid;
srcmsid=xdoc.DocumentElement.ChildNodes[1].ChildNodes[0].InnerText;
x=xdoc.DocumentElement.ChildNodes[1].ChildNodes[3].InnerText;
y=xdoc.DocumentElement.ChildNodes[1].ChildNodes[4].InnerText;
public string GetNodeValue()
{
string strXML = " <?xml version=1.0 encoding=gb2312?><mtylbs_slis_rsp><mtylbs_slisrsp_header><seqid>112</seqid><result>0</result></mtylbs_slisrsp_header><mtylbs_slisrsp_body><srcmsid>13553155019</srcmsid><destmsid>13553155019</destmsid><time>20051223160803</time><x>116.99188</x><y>36.65860</y><areacode>0531</areacode><errordes></errordes></mtylbs_slisrsp_body></mtylbs_slis_rsp>";y
string strSrcmsid = GetSingleNodeValue(strXML, "//mtylbs_slis_rsp/mtylbs_slisrsp_body/srcmsid"); return strSrcmsid;
}
public string GetSingleNodeValue(string strIn, string strNodePath)
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(strIn);
XmlNode node = xmlDoc.SelectSingleNode(strNodePath);
return node.InnerText.Trim();
}
修改哈希
Hashtable ht = new Hashtable();
ht.Add(1, point);
Point p2 = ((Point)ht[1]);
p2.px = 116.6;