<?xml version="1.0" standalone="yes" ?>
<customer>
<goo cost="150.0000" date="2007-3-16 8:13:30" />
<info>aa</info>
</customer>怎么获得info节点的值,,只能使用dataset。
<customer>
<goo cost="150.0000" date="2007-3-16 8:13:30" />
<info>aa</info>
</customer>怎么获得info节点的值,,只能使用dataset。
///
/// 读取Xml返回一个经排序或筛选后的DataView
///
///
/// 筛选条件,如:"name = 'kgdiwss'"
/// 排序条件,如:"Id desc"
///
public static DataView GetDataViewByXml(string strXmlPath,string strWhere,string strSort)
{
try
{
DataSet ds = new DataSet();
ds.ReadXml(GetXmlFullPath(strXmlPath));
DataView dv = new DataView(ds.Tables[0]);
if(strSort != null)
{
dv.Sort = strSort;
}
if(strWhere != null)
{
dv.RowFilter = strWhere;
}
return dv;
}
catch(Exception)
{
return null;
}
}
#endregion
public void loadSmtpInfo(string smtpXmlPath)
{
XmlDocument xmldocument = new XmlDocument();
xmldocument.Load(smtpXmlPath);
XmlNodeList nodelist = xmldocument.GetElementsByTagName("smtp");
string info;
foreach(XmlNode node in nodelist)
{
this.info= node["info"].InnerXml;
}
}
public void loadSmtpInfo(string smtpXmlPath)
{
XmlDocument xmldocument = new XmlDocument();
xmldocument.Load(smtpXmlPath);XmlNodeList nodelist = xmldocument.GetElementsByTagName("customer");string info;
foreach(XmlNode node in nodelist)
{
this.info= node["info"].InnerXml;}}
ds.ReadXml(file);
DataTable dt = ds.Tables["customer"];
MessageBox.Show(dt.Rows[0]["info"].ToString());