Currently, if I try to parse
<parent>
First bit of text
<child>
</child>
Second bit of text
</parent>
I only get First bit of text
with
parent.text().get()
What's the correct way to grab all text nodes in parent
?
- Is there a nice utility function for this?
- How could it be done iterating though all children?
There is no function that concatenates all text; if you want to get a list of text node children, you have two options:
XPath query:
Manual iteration w/type checking:
Note that if you can use C++11 then the second option can be much more concise:
(of course, you can also use ranged for to iterate through xpath_node_set)
In the version of pugixml I have, I can use the print method to get all the inner xml from a node into a stream. E.g.:
std::stringstream ss;
node.print(ss);
return ss.str();