Reputation: 823
I want to select some detail from a webpage content
<div id="realty_widget_property_description" class="property_block realty_widget_property_description widget widget-2 alt">
<p class="title "><strong>Apartment for Rent </strong></p>
<div class="property-description ">
<p class="property_description">
</p><p>– Property ID: P-000324<br>
– Location: Phsar Chas<br>
– Price: $350/month<br>
– Bed/Bath: 2 beds / 2 Baths<br>
– Size: 4m x 18m<br>
– Story: 1st<br>
– Fully Furnished<br>
– Description: This apartment is in residential area and good location for living with comfortable and fresh air. There are 2 bedrooms, 2 bathrooms, a living room, a kitchen and the balcony. Close to everywhere in town such as school, market, clinic, Bank, coffee shop and just ride a few minutes to Phsar Chas Market.<br>
How can I select Property ID, Location, price,size, story and description if they all stay in the same class?
Upvotes: 0
Views: 182
Reputation: 167426
Use e.g. substring-after(//div[@id = 'realty_widget_property_description']/div[@class = 'property-description ']/p[2]/text()[1], ': ')
to extract a string value. But be aware that that XPath expression returns a string value and not a node, so you need to make sure you use an XPath API that supports that.
Upvotes: 1