<body>
<div>some text</div>
I NEED THIS TEXT ONLY
<div>some text</div>
more text here
<div>some text</div>
one more text here
<div>some text</div>
</body>
How?
<body>
<div>some text</div>
I NEED THIS TEXT ONLY
<div>some text</div>
more text here
<div>some text</div>
one more text here
<div>some text</div>
</body>
How?
This XPath 1.0:
Also:
I don't have nokogiri, but here's an alternative using just basic string manipulation.
Use:
This selects the first text-node sibling of the first
div
child of the top element of the document.this returns the first text node within
body
between twodiv
elements:should return