Reputation: 22440
I found some elements where several documents within. How can i locate individual document by creating an xpath expression, as in email and phone? I tried with:
//div[@class="professional-info-content"]/text()
but it gives all the docs.
Here are the elements:
<div class='professional-info-content'><b>Impressum:</b><br/>hokon
<br/>Jörn Brenscheidt GmbH
<br/>Wasserbank 21
<br/>D-58456 Witten Herbede
<br/>
<br/>Tel.: 0049 (0) 2302 780100
<br/>Fax: 0049 (0) 2302 780110
<br/>E-Mail: [email protected]
<br/>www.hokon.de</div>
Upvotes: 0
Views: 16
Reputation: 241968
/div[@class="professional-into-content"]/text()
returns a node list of all the text nodes under the div. To get only a specific one, you can specify an index, e.g.:
/div[@class="professional-into-content"]/text()[6]
returns the telephone number and
/div[@class="professional-into-content"]/text()[8]
the email.
Upvotes: 1