objective c - TouchXML elementsForName Not Working -
i have div
element in touchxml, , know fact contains a
element need access. element, declared cxmlelement *element
in for-in loop
<div id="song_html" class="show3"> <div class="left"> <!-- info mp3 here --> 128 kbps<br/>2:35<br/>2.36 mb </div> <div id="right_song"> <div style="font-size:15px;"><b>the doors - crystal ship mp3</b></div> <div style="clear:both;"/> <div style="float:left;"> <div style="float:left; height:27px; font-size:13px; padding-top:2px;"> <div style="float:left;"><a href="http://member.jinbo.net/renegade/music/the doors-03.the crystal ship.mp3" rel="nofollow" target="_blank" style="color:green;">download</a></div> <div style="margin-left:8px; float:left; width:27px; text-align:center;"><a href="javascript:void(0)" onclick="showplayer_new(14851327, 'a89d3a80a719b6c91a4c441f879685e1c8647140', 'the+doors', 'the+crystal+ship')" rel="nofollow" id="lk14851327" class="play_now">play</a></div> <!-- new ad start --> <script><![cdata[ var id_array = ["newad14851327"]; window.onload = function(){ var = 0; for(i=0; < id_array.length; i++){ var tgt = document.getelementbyid(id_array[i]).href; document.getelementbyid(id_array[i]).href = ""; document.getelementbyid(id_array[i]).onclick = function(){ window.location.href= tgt; return false; }; } } ]]> </script><!-- new ad end --> <div style="margin-left:8px; float:left;"><a href="http://ads.ad-center.com/offer?prod=91&ref=4989201&q=the+doors+-+the+crystal+ship" rel="nofollow" target="_blank" style="color:red;" id="newad14851327">download album</a></div> <!-- tonefuse start --> <script><![cdata[ (function(id) { console.log("tonefuse id:"+id); document.write('<div style="margin-left:8px; float:left; color:red;" id="'+id+'">]]> </script> </div> '); tfp_multi_ad_slots = window.tfp_multi_ad_slots || []; tfp_multi_ad_slots.push(id); window.tfpwritemultiad && tfpwritemultiad(); })(("tfp_multi_"+math.random()).replace(".","")); <!-- tonefuse end --> <div style="clear:both;"/> </div> <div id="player14851327" style="float:left; margin-left:10px;" class="player"/> </div> <div style="clear:both;"/> </div>
(sorry formatting; didn't write it)
as can see, there a
element (there's two) in this. however, when attempt access these elements using following
nsarray *linkelements = [element elementsforname:@"a"];
linkelements
contains 0 objects. why touchxml not filling linkelements
2 a
elements?
the elementsforname:
method looks @ immediate child nodes of element. not recursive descent. in posted code, element
not have a
elements, more div
child elements. need write own code recursively traverse of child div
elements until find of desired a
elements.