Sohail Ahmed
Sohail Ahmed

Reputation: 1667

Scrape data of a div after one or two html tags using xpath

Here is the code:

<div id="content">
   <div class="datebar">
      <span style="float:right">some text1</span>
      <b>some text2</b>
Thursday, September 8, 2011 - 1:17 pm EDT
   </div>
</div>

I just want to extract date and time Thursday, September 8, 2011 - 1:17 pm EDT.
Any suggestions? Thanks.

Upvotes: 0

Views: 171

Answers (1)

Flack
Flack

Reputation: 5892

div[@id = 'content']/div[@class = 'datebar']/text()

or

div[@id = 'content']/div[@class = 'datebar']/b/following-sibling::text()

Though it should be normalized after.

Upvotes: 2

Related Questions