本文介绍了XML解析Jquery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个带有四个<resultGroups>
标记的XML文件:
I have an XML file which has four <resultGroups>
tag:
<resultGroups>
<subGroups>
<results> </results>
<results> </results>
</subGroups>
<name> </name>
</resultGroups>
每个<resultGroup>
具有多个<subGroups>
,每个<subGroups>
具有多个<result>
标签.
each <resultGroup>
has several <subGroups>
and each <subGroups>
has several <result>
tag.
我想在每个子组,每个resultGroups等中获取结果"标签的编号...
I want to get the no of "results" tag in each subgroups, each resultGroups etc...
我该如何使用jQuery ...
How can i do that using jQuery...
推荐答案
$xml = $(xmlString);
$('resultGroups', $xml).each(function() {
$('subGroups', this).each(function() {
var count = $('results', this).length;
// do whatever
});
});
这篇关于XML解析Jquery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!