Xpath – get only node content without other elements

To get the string value of div use:

string(/div)

This is the concatenation of all text nodes that are descendents of the (top) div element.

To select all text node descendents of div use:

/div//text()

To get only the text nodes that are direct children of div use:

/div/text()

Finally, get the first (and hopefully only) non-whitespace-only text node child of div:

/div/text()[normalize-space()][1]

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)