求助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>
<!-- 站点路线 --&
相关问答:
从数据库中查询一张表的数据
select 部门,姓名 from tb
如何才能生成下面的xml格式文件
<folder state="unchecked" label="全部">
<folder state="unchecked" isBra ......
我用jquery无刷新上传图片后返回json格式的数据报错
(实际上图片是上传成功的了,只是返回json格式总读不到,总是报错)
我调试上传的ashx页如下
无法显示 XML 页。
使用 样式表无法查看 XML 输入。请更 ......
Private Sub Command1_Click()
Dim MyString() As String
Open "a.xml" For Binary As #1 ' 打开刚创建的文件。
ReDim MyString(LOF(1) - 1)
Put #1, , MyRecord ' 读入所有字符到变量中 ......
现在有个xml文件是<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xm ......
思路:要用c#生成一个播放机的播放列表的xml,例如:
<daty datys='2010-04-05' datye='2010-05-01' > //这是播放的日期段
<time times='01:12:00' timee='02:30:00'> ......