I have a HTML tree where I use the 'string()'
query on the root to get all the text from the nodes.
However, I'd like to add a space between each nodes.
I.e.
string()
on '<root><div>abc</div><div>def</div></root>'
will become 'abcdef'
string()
on '<root><div>abc</div><div>def</div></root>'
should become 'abc def '
You can try with
itertext()
method, that iterates over all text content:It yields: