Note that there are some explanatory texts on larger screens.

plurals
  1. POHpple in Objective-C can't find a particular object (XML/HTML Parser)
    primarykey
    data
    text
    <p>For those veterans who haven't tried Hpple, it's great. It uses Xpath for searching through HTML/XML documents. It gets the job done and it's easy enough for a newbie like me to understand. However, I'm having trouble. </p> <p>I have this chunk of HTML:</p> <pre><code> &lt;ul class="challengesList dailyChallengesList"&gt; &lt;li&gt; &lt;div class="corner topLeft"&gt;&lt;/div&gt; &lt;img id="ctl00_mainContent_dailyChallengesRepeater_ctl00_challengeImage" title="Gunslinger" src="/images/reachstats/challenges/0.png" alt="Gunslinger" style="border-width:0px;"&gt; &lt;div class="info"&gt; &lt;div class="rFloat"&gt; &lt;p id="ctl00_mainContent_dailyChallengesRepeater_ctl00_challengeExpiration" class="timeDisplay dailyExpirationCountdown"&gt;&lt;span&gt;0d&lt;/span&gt;&lt;span&gt;19h&lt;/span&gt;&lt;span&gt;9m&lt;/span&gt;&lt;span class="seconds"&gt;37s&lt;/span&gt;&lt;/p&gt; &lt;p&gt;1500cR&lt;/p&gt; &lt;/div&gt; &lt;h5&gt;Gunslinger&lt;/h5&gt; &lt;p class="description"&gt;Kill 150 enemies in multiplayer Matchmaking.&lt;/p&gt; &lt;div class="reward"&gt; &lt;div id="ctl00_mainContent_dailyChallengesRepeater_ctl00_progressBox" class="barContainer"&gt; &lt;div id="ctl00_mainContent_dailyChallengesRepeater_ctl00_progressBar" class="bar" style="width:21%;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt; &lt;p&gt;31/150&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="clear"&gt;&lt;/div&gt; &lt;/li&gt; &lt;li&gt; &lt;div class="corner topLeft"&gt;&lt;/div&gt; &lt;img id="ctl00_mainContent_dailyChallengesRepeater_ctl01_challengeImage" title="A Great Friend" src="/images/reachstats/challenges/0.png" alt="A Great Friend" style="border-width:0px;"&gt; &lt;div class="info"&gt; &lt;div class="rFloat"&gt; &lt;p id="ctl00_mainContent_dailyChallengesRepeater_ctl01_challengeExpiration" class="timeDisplay dailyExpirationCountdown"&gt;&lt;span&gt;0d&lt;/span&gt;&lt;span&gt;19h&lt;/span&gt;&lt;span&gt;9m&lt;/span&gt;&lt;span class="seconds"&gt;37s&lt;/span&gt;&lt;/p&gt; &lt;p&gt;1400cR&lt;/p&gt; &lt;/div&gt; &lt;h5&gt;A Great Friend&lt;/h5&gt; &lt;p class="description"&gt;Earn 15 assists today in multiplayer Matchmaking.&lt;/p&gt; &lt;div class="reward"&gt; &lt;div id="ctl00_mainContent_dailyChallengesRepeater_ctl01_progressBox" class="barContainer"&gt; &lt;div id="ctl00_mainContent_dailyChallengesRepeater_ctl01_progressBar" class="bar" style="width:40%;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt; &lt;p&gt;6/15&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="clear"&gt;&lt;/div&gt; &lt;/li&gt; &lt;li&gt; &lt;div class="corner topLeft"&gt;&lt;/div&gt; &lt;img id="ctl00_mainContent_dailyChallengesRepeater_ctl02_challengeImage" title="Cannon Fodder" src="/images/reachstats/challenges/2.png" alt="Cannon Fodder" style="border-width:0px;"&gt; &lt;div class="info"&gt; &lt;div class="rFloat"&gt; &lt;p id="ctl00_mainContent_dailyChallengesRepeater_ctl02_challengeExpiration" class="timeDisplay dailyExpirationCountdown"&gt;&lt;span&gt;0d&lt;/span&gt;&lt;span&gt;19h&lt;/span&gt;&lt;span&gt;9m&lt;/span&gt;&lt;span class="seconds"&gt;37s&lt;/span&gt;&lt;/p&gt; &lt;p&gt;1000cR&lt;/p&gt; &lt;/div&gt; &lt;h5&gt;Cannon Fodder&lt;/h5&gt; &lt;p class="description"&gt;Kill 50 infantry-class foes in the Campaign today.&lt;/p&gt; &lt;div class="reward"&gt; &lt;div id="ctl00_mainContent_dailyChallengesRepeater_ctl02_progressBox" class="barContainer"&gt; &lt;div id="ctl00_mainContent_dailyChallengesRepeater_ctl02_progressBar" class="bar" style="width:0%;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt; &lt;p&gt;0/50&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="clear"&gt;&lt;/div&gt; &lt;/li&gt; &lt;li&gt; &lt;div class="corner topLeft"&gt;&lt;/div&gt; &lt;img id="ctl00_mainContent_dailyChallengesRepeater_ctl03_challengeImage" title="Heroic Demon" src="/images/reachstats/challenges/3.png" alt="Heroic Demon" style="border-width:0px;"&gt; &lt;div class="info"&gt; &lt;div class="rFloat"&gt; &lt;p id="ctl00_mainContent_dailyChallengesRepeater_ctl03_challengeExpiration" class="timeDisplay dailyExpirationCountdown"&gt;&lt;span&gt;0d&lt;/span&gt;&lt;span&gt;19h&lt;/span&gt;&lt;span&gt;9m&lt;/span&gt;&lt;span class="seconds"&gt;37s&lt;/span&gt;&lt;/p&gt; &lt;p&gt;1500cR&lt;/p&gt; &lt;/div&gt; &lt;h5&gt;Heroic Demon&lt;/h5&gt; &lt;p class="description"&gt;Kill 30 Elites in Firefight Matchmaking on Heroic or harder.&lt;/p&gt; &lt;div class="reward"&gt; &lt;div id="ctl00_mainContent_dailyChallengesRepeater_ctl03_progressBox" class="barContainer"&gt; &lt;div id="ctl00_mainContent_dailyChallengesRepeater_ctl03_progressBar" class="bar" style="width:0%;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt; &lt;p&gt;0/30&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="clear"&gt;&lt;/div&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>The nutty part is, I cannot get Hpple to "see" the <code>&lt;div class="reward"&gt;</code>. I'm using the following to find it: </p> <pre><code>NSArray * rawProgress = [doc search:@"//ul[@class='challengesList'] /li/div[@class='info'] /div[@class='reward']/p"]; </code></pre> <p>This always returns an empty array. It's driving me nuts, as the same kind of thing worked for all of the other elements in this project...</p> <p>Any help would be appreciated :)</p> <p><strong>EDIT</strong></p> <p>This works: </p> <pre><code>NSArray * rawDescriptions = [doc search:@"//ul[@class='challengesList'] /li/div[@class='info'] /p[@class='description']"]; </code></pre> <p>This doesn't:</p> <pre><code>NSArray * rawProgress = [doc search:@"//ul[@class='challengesList'] /li/div[@class='info'] /div[@class='reward'] /div[@id]//p"]; </code></pre> <p>Furthermore, trying to list the child nodes of rFloat or reward produces a crash :(</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload