visual c++ - Update XML nodevalue with C++ -


i have xml below

<root>   <device>     <host>localhost</host>     <port>52000</port>   </device>   <devicehost>     <server>server.exe</server>     <port>81</port>   </devicehost>   <settings> <flag1>100</flag1> <flag2>2000</flag2>   </settings> </root> 

how can update flag1 , flag2 200 , 4000 respectively without changing other values using vc++?

i have 2 function wrote using api msxml.

 doc.loadxml(data);//for loading xml data  doc.save(filepath);//for saving xml data 

but issue before saving how can update 2 node values

you need correct node calling getelementsbytagname (which should return nodelist containing 1 item) , call put_nodevalue write value -- there msdn samples here , here

edit: should able use doc.selectsinglenode("/root/flag1", &pnode) per this msdn article


Comments