This is the XML File:
<Test>
<Category>
<SubCat>
<Name>Name</Name>
<Properties>
<Key>Key</Key>
<Value>Value</Value>
</Properties>
</SubCat>
<SubCat>
<Name>Name</Name>
<SubCat>
<Name>AnotherName</Name>
<Properties>
<Key>Key</Key>
<Value>Value</Value>
</Properties>
</SubCat>
</SubCat>
</Category>
</Test>
I would like to get the Name. But only the Name of the first SubCat. And the properties key value. The problem is the SubCat exist two times.
I tried this:
$(xml).find('SubCat').each(function() {
var name = $(this).find("Name").text();
alert(name);
}
but this show the name of the first and the second SubCat.
i search for something like this.
rootElement(Category).selectallchildren(SubCat).Name for the first SubCat Name
rootElement(Category).selectallchildren(SubCat).(SubCat).Name for the second SubCat Name
And same explicit select for the Key and values
$(xml).find('Category').each(function() { $(xml).find('SubCat:first').each(function() { var name = $(this).find("Name").text(); alert(name); });});but it show me only the name of the first subcat item