求助xml的读取问题 - .NET技术 / C#
我想建一个数组strs保存来自XMLFile1.xml的相关数据。数组最后是用来给combobox选择用的
这是我用来模糊查询用的: XmlDataDocument _xmlData = null;
XmlNodeList _xmlNodeList = null;
try
{
string xmlFile = Application.StartupPath + "\\XMLFile1.xml";
_xmlData = new XmlDataDocument();
_xmlData.Load(xmlFile);
string xpath = "//lines";
if (textBox1.Text != "")
{
xpath += "[contains(name,'{0}')]";
xpath = String.Format(xpath, this.textBox1.Text);
}
这是关联combobox的代码:
if (this.comboBox1.Text == "aaa")
{
this.comboBox2.Items.Clear();
comboBox2.Items.Add("选择");
string[] temp =strs[0].Split(',');
for (int i = 0; i < temp.Length; i++)
comboBox2.Items.Add(temp[i]);
}
XMLFile1.xml如下:
<?xml version="1.0" encoding="utf-8" ?>
<bus>
<linestops>
<!-- 站点路线 --&
相关问答:
DataSet导出xml 批处理(循环)得怎么处理
XML文件
<A>
<B>
<C>
</C>
&nb ......
现在有个xml文件是<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xm ......
我用XmlDocument生成XML
XmlElement remarkNode = node.OwnerDocument.CreateElement("remark");
remark1Node.InnerXml = "";
如果InnerXml赋值不为空,则生成的标记是没问题的,比如:<r ......
使用ACCESS最大的隐患就是不安全。今天对ACCESS数据库设置了一个密码,必须使用密码才能打开,但是在程序中却无法连接数据库了。大家知道使用用户名和密码,如何连接ACCESS数据库?貌似ACCESS的用户名还不知道?只知 ......