如何从XML中提取数据 [英] How do I extract data from XML
本文介绍了如何从XML中提取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我对Javascript和XML很新。这是我的XML文件的片段。
Hi,
I quite new to Javascript and XML. Here a is snippet of my XML file.
展开 | 选择 | Wrap | 行号
推荐答案
实际上这个文件在哪里存在??
debasis
actually where this file exists??
debasis
Gordon,欢迎来到TSDN!
查看此链接。你会想要使用document.getElementsByTagName()方法。
Gordon, welcome to TSDN!
Check out this link. You''ll want to make use of the document.getElementsByTagName() method.
你好了,
我看过那个链接。但是,我只想获得< rock>中项目的''name''。
我试过了
xmldoc.getElementsByTagName(''items'' )
但是这给了我所有的项目,包括< pop>中的项目。
dmjpro,
文件是一个单独的xml和javascript在我的html文档中。我设法成功加载了xml。
Hi acoder,
I''ve seen that link. However, I just want to get the ''name'' for the items in <rock>.
I have tried
xmldoc.getElementsByTagName(''items'')
but that gives me all the items, including those in <pop>.
dmjpro,
the file is a seperate xml and the javascript is in my html document. I manage to successfully load the xml already.
这篇关于如何从XML中提取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文