This is my HTML:
Description
string(/)
will return the string value of the whole document.
Update: To return the four separate strings returned by this XPath,
.//h3[@class='description-area']/following-sibling::p//text()[count(preceding-sibling::br) >= 0]
as a single string, wrap the above XPath similarly in string()
:
string(.//h3[@class='description-area']/following-sibling::p//text()[count(preceding-sibling::br) >= 0])
Update 2: But the br
and text()
maneuvers aren't necessary. You can simply get the string value of the p
:
string(.//h3[@class='description-area']/following-sibling::p)