Say I have xml like this:
<outer>
<inner name="name0" type="type0" />
<inner name="name1" type="type1" />
<inner name="name2" type="type2" />
</outer>
I'm parsing the xml using jquery and I'm inside the each loop of the outer tag:
$(xml).find('outer').each(function() {
//what goes here?
});
Say I know the values that can appear in the name id of <inner>
. How do I, in the code above, get the appropriate type from the given <inner>
tag.
Example:
I have the string var name = "name1"
Inside the each loop, I need to pull type1
from the <inner>
tag that has name="name1". Thanks