Reputation: 277
<div>
foo
<br />
bar
<br />
baz
</div>
Upvotes: 1
Views: 160
Reputation: 28004
bar
and baz
are siblings of each other, and children of the <div>
element.2 has already been answered correctly.
Upvotes: 2
Reputation: 5174
First Question :
bar and baz are text nodes of the element div.
Second question :
The following XPath expression.
/div/text()[not(contains(., "foo"))]
This would work and leave foo out of the retrieved data.
Upvotes: 4
Reputation: 13986
Use node test text()
to to select text nodes.
/div/text()
Selects "foo", "bar" and "baz" (and the whitespace) text node children of <div>
.
Upvotes: 2