比较两个xml文件 [英] comparing two xml files

查看:98
本文介绍了比较两个xml文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个下拉列表.我有两个xml文件.一个具有标题列表,另一个具有每个标题的名称列表.

如果在下拉菜单中选择了一个标题,则另一个下拉菜单应过滤该特定标题的名称.如何使用与这两个下拉列表相关的xml数据源.

我能够在第一个下拉菜单中读取并填充标题,但在另一个下拉列表中却难以进行过滤.请给我足够的信息.

I have two dropdownlists. I have two xml files. one has list of titles , other one has list of names for each title.

if one title is selected in th dropdown , the other dropdown should filter the names for that specific title. How can I use the xml datasource relating these two drop downlist.

I''m able to read and populate the titles in the first dropdown but strugling to filter the names in the other dropdown. Pleas give me enough information.

推荐答案

我的建议是使用xquery这样的东西.

http://forums.asp.net/t/1182136.aspx/1 [ ^ ]

http://cankansu.blogspot.com/2008/11/using-xquery-in- c.html [^ ]

http://www.w3schools.com/xquery/xquery_select.asp [ http://msdn.microsoft.com/en-us/library/bb387071.aspx [ ^ ]

祝你好运!
My advice would be to use xquery for something like this.

http://forums.asp.net/t/1182136.aspx/1[^]

http://cankansu.blogspot.com/2008/11/using-xquery-in-c.html[^]

http://www.w3schools.com/xquery/xquery_select.asp[^]

Also, linq might be helpful depending on the .net version you''re using.
http://msdn.microsoft.com/en-us/library/bb387071.aspx[^]

Good luck!



我的建议是将xml读入DataTable并执行LINQ以提取为列表....由于您没有提供xml内容,因此它看起来如何

我假设将xml读入DataTable的结果在DataTable的Title和Name列中

使用以下内容获取
Hi
What i suggest is read xml into DataTable and perform LINQ to extract as a list....As you haven''t provided xml content how it looks

I assume reading xml into DataTable results in Title and Name columns in DataTable

Use following to get
   DataTable tab = new DataTable();
            tab.ReadXml(xmlContent);
              var stateList = from row in tab1.AsEnumerable().AsQueryable()
                            group row by row["Title"] into b
                            select new { Title = b.Key, StateList = from state in b.OfType<datarow>() select state["State"] };
</datarow>



在stateList上按标题显示名称列表...

希望对您有帮助....



on stateList by title it gives list of Names ...

Hope this helps you....


这篇关于比较两个xml文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆