how to compare the value from sub child tag of xml
IN xml i am having to many parent tags inside every parent tag i am having
too many child and on child tag is having too many sub child and i want
help that i wanted to compare the number which is present in sub child tag
and number which i wanted to compare is present in every parent tags sub
child tags but i want to compare first parent tags sub child tags then it
goes to another parent tags
In XML:-
ad>
<i>a</i>
<p>
<z>4</z>
<z>2</z>
<z>1</z>
<z>5</z>
</p>
</ad>
<ad>
<i>b</i>
<p>
<z>9</z>
<z>6</z>
<z>1</z>
<z>5</z>
</p>
</ad>
you can see that ad tag is parent tag inside p tag is child tag "p" tag is
having too many sub child tag now i want to compare the number 1 which is
present in sub child tag how i can compare
i am making app in phonegap
in jquery :-
var reg = new RegExp('^[0-9]+$');
var a = 1;
$(result).find('ad').each(function(){
var d = $(this).find('i').text();
var p1 = $(this).find('z:first').text();
if(d.match(reg) !== null) {
}else{
if(a == p1){
var s ='<a href="#">'+d+'</a>';
$("#xyz").append(s).trigger('create');
}
}
});
like that i try but it only first sub child not all please help me out
thank u in advance
No comments:
Post a Comment