1

I have an XML file which has four <resultGroups> tag:

<resultGroups> 
    <subGroups>
        <results> </results>
        <results> </results>
    </subGroups>
    <name> </name>
</resultGroups>

each <resultGroup> has several <subGroups> and each <subGroups> has several <result> tag.

I want to get the no of "results" tag in each subgroups, each resultGroups etc...

How can i do that using jQuery...

1 Answer 1

3
$xml = $(xmlString);
$('resultGroups', $xml).each(function() {
    $('subGroups', this).each(function() {
        var count = $('results', this).length;
        // do whatever
    });
});
Sign up to request clarification or add additional context in comments.

2 Comments

thnk u for tht..... If u don't mind can u just give me different approaches or methods possible on an XMl using jquery???
I'm not sure what you mean? You can do any traversing you want, get attributes, set attributes... just read up on the jQuery documentation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.