从xml文件填充treeview,但只填充某些标签 [英] filling treeview from xml file, but only certain tags

查看:82
本文介绍了从xml文件填充treeview,但只填充某些标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试从xml文件中recursivley填充树视图。当xml和treeview的内容匹配1:1时,它运行良好,




代码: http://mad-scientists.co.uk/micha/shownode.txt


a样本xml doc可以在这里找到:

http://mad-scientists.co.uk/micha/CurrentSearch.xml


问题是,xml文件包含更多项目然后我想在树视图中显示


我只想显示带有某些标签的项目。 (OPTEXT& ITEXT)

其他标签应该用于生成SQL WHERE子句。

我尝试了各种版本的


if tag =" this"然后

nod = nodes.add(bla,child)

结束如果


但是我根本就没有得到它上班。我很绝望!

I try to recursivley fill a treeview from a xml-file. It works well,
when the contents of the xml and the treeview match 1:1.

code here: http://mad-scientists.co.uk/micha/shownode.txt

a sample xml doc can be found here:

http://mad-scientists.co.uk/micha/CurrentSearch.xml

the problem is, that the xml file contains more items then I want to
show in the treeview.
I only want to show items with certain tags. (OPTEXT & ITEXT)
The other tags should be used to generate a SQL WHERE clause.
I tried various versions of

if tag = "this" then
nod=nodes.add(bla, child)
end if

but I simply don''t get it to work. I''m desperate!

推荐答案

minimalniemand写道:
minimalniemand wrote:

我尝试recursivley从xml文件中填充树视图。当xml和treeview的内容匹配1:1时,它运行良好,




代码: http://mad-scientists.co.uk/micha/shownode.txt


a样本xml doc可以在这里找到:

http://mad-scientists.co.uk/micha/CurrentSearch.xml


问题是,xml文件包含更多项目然后我想在树视图中显示


我只想显示带有某些标签的项目。 (OPTEXT& ITEXT)
I try to recursivley fill a treeview from a xml-file. It works well,
when the contents of the xml and the treeview match 1:1.

code here: http://mad-scientists.co.uk/micha/shownode.txt

a sample xml doc can be found here:

http://mad-scientists.co.uk/micha/CurrentSearch.xml

the problem is, that the xml file contains more items then I want to
show in the treeview.
I only want to show items with certain tags. (OPTEXT & ITEXT)



您甚至没有告诉我们使用哪种编程语言和框架

以及您正在使用哪种树视图。该示例看起来像VB或VB.NET

虽然不清楚为什么要将MSXML与.NET

框架一起使用。你可能最好在小组中询问经典的VB,如果你使用的是b / b
,或者在VB.NET小组中。您可以考虑使用XPath来处理您感兴趣的那些元素,以便在树视图中显示,而不是处理所有

子元素。


-


Martin Honnen
http://JavaScript.FAQTs.com/


非常感谢您的回答。

我故意离开编程语言出来,给我一个建议

伪代码对我来说应该没问题。


但它的VB6& MSXML和我也发布在VB组中。


7月31日14:57,Martin Honnen< mahotr ... @ yahoo.dewrote:
Thanks a lot for your answer.
I intentionally left the programming language out, cause an advice in
pseudo code should be ok for me.

but its VB6 & MSXML and I also posted in a VB group.

On 31 Jul., 14:57, Martin Honnen <mahotr...@yahoo.dewrote:

minimalniemand写道:
minimalniemand wrote:

我尝试从xml文件中recursivley填充树视图。当xml和treeview的内容匹配1:1时,它运行良好,


I try to recursivley fill a treeview from a xml-file. It works well,
when the contents of the xml and the treeview match 1:1.


code here: http://mad-scientists.co.uk/micha/shownode.txt


a示例xml doc可以找到这里:
a sample xml doc can be found here:

http://mad-scientists.co.uk/micha/CurrentSearch.xml


问题是,xml文件包含更多项目然后我想在树视图中显示


我只想显示带有某些标签的项目。 (OPTEXT& ITEXT)
the problem is, that the xml file contains more items then I want to
show in the treeview.
I only want to show items with certain tags. (OPTEXT & ITEXT)



您甚至没有告诉我们使用哪种编程语言和框架

以及您正在使用哪种树视图。该示例看起来像VB或VB.NET

虽然不清楚为什么要将MSXML与.NET

框架一起使用。你可能最好在小组中询问经典的VB,如果你使用的是b / b
,或者在VB.NET小组中。您可以考虑使用XPath来处理您感兴趣的那些元素,以便在树视图中显示,而不是处理所有

子元素。


-


Martin Honnen
http://JavaScript.FAQTs.com/


minimalniemand写道:
minimalniemand wrote:

但它的VB6& MSXML和我也发布在VB组中。
but its VB6 & MSXML and I also posted in a VB group.



使用Msxml2.DOMDocument30或更高版本,然后您可以应用XPath来查找名称的
子节点,例如

node.selectNodes(" OPTEXT | ITEXT")

-


Martin Honnen
http://JavaScript.FAQTs.com/


这篇关于从xml文件填充treeview,但只填充某些标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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