0

I'm new about hpple and xpath. for the below html code,I want to get both "title" and "tag" information.

From hpple's example code, I can get a array of title, and another array of tag. But if there are six properties I'm interested, there will be six arrays.

can I find the div[class="entry"], then get its child's , div[class="meta"]? (can anybody share the code?)

Thanks.

<div class="content">

<div id="1" class="entry">
  <h2 class="title"> title for  entry 1 </h2>
 <div class="meta"> tag:xxx </div>
</div>

<div id="2" class="entry">
  <h2 class="title"> title for  entry 2 </h2>
 <div class="meta"> tag:xxx </div>
</div>

...

</div>
Ke CAI
  • 233
  • 6
  • 17
  • Array is not an XPath data type. Please consired to rephrase this question in order to be answerable. –  Mar 17 '11 at 12:27

2 Answers2

1
@"//div[@class='content']//div[@class='entry']//div[@class='meta']"

This returns tag:xxx for both entries.

Anirudh Ramanathan
  • 46,179
  • 22
  • 132
  • 191
CSL
  • 140
  • 1
  • 5
0

I want to get both "title" and "tag" information

//div[@class='content']/div[@class='entry']/*[@class='meta' or @class=title"']

This XPath gets all tags with class title or meta children of div class entry child of any div class content.

Emiliano Poggi
  • 24,390
  • 8
  • 55
  • 67