falcong / pugixml

Automatically exported from code.google.com/p/pugixml
0 stars 0 forks source link

Setting child value #137

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
How can I set the child_value() in

pugi::xml_document doc;
doc.load("<node id='123'>text</node>")

from 'text' to 123?

Thanks, Sam

Original issue reported on code.google.com by samkhali...@hotmail.com on 7 Dec 2011 at 9:04

GoogleCodeExporter commented 9 years ago
There is no helper function, so you have to access the node that contains 
"text" value directly:
doc.child("node").first_child().set_value("123")

(doc.child("node").first_child() is a separate node with type() == node_pcdata).

Original comment by arseny.k...@gmail.com on 7 Dec 2011 at 9:23

GoogleCodeExporter commented 9 years ago

Original comment by arseny.k...@gmail.com on 9 Dec 2011 at 5:53