falcong / pugixml

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

Not able to set and get values of the node #173

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I am trying to add new node. I can do it successfully. But when i try to set 
node value it fails. same with get node value.
To set node value I am using follwing code:
pugi::xml_node m_XmlNode
pugi::char_t* nodeVal; //value is assigned while calling

   valOk = m_XmlNode.set_value(nodeVal);
   if(valOk == false)
   {
       return error;
   }

to get node value i am using following code:

pugi::char_t* nodeValue ;
nodeValue = m_XmlNode.value();

Please help me to find the solution.

kshitija

Original issue reported on code.google.com by kshitija...@gmail.com on 18 Sep 2012 at 7:08

GoogleCodeExporter commented 9 years ago
PCDATA content is not a node value; it lives in a separate node.
You can use text() object for a convenient access:

node.text().set(nodeVal);
node.text().get()

Original comment by arseny.k...@gmail.com on 18 Sep 2012 at 7:19

GoogleCodeExporter commented 9 years ago
thanks. I tried with this code and my problem is solved. Thanks.

Kshitija

Original comment by kshitija...@gmail.com on 18 Sep 2012 at 7:39

GoogleCodeExporter commented 9 years ago

Original comment by arseny.k...@gmail.com on 18 Sep 2012 at 7:39