开发者

changing value of a tag through XML parser

开发者 https://www.devze.com 2023-02-22 00:59 出处:网络
I am new to XML. I want to change the value of a tag in an xml 开发者_开发百科file. I am using Xerces c++ library for this purpose. Can anyone tell me how to do it ?load the XML document: xmlDoc=loadX

I am new to XML. I want to change the value of a tag in an xml 开发者_开发百科file. I am using Xerces c++ library for this purpose. Can anyone tell me how to do it ?


load the XML document: xmlDoc=loadXMLDoc("temp.xml");

get the tag "tag1" you want to write (first one):DOMNode x=xmlDoc.getElementsByTagName("tag1")[0];

get the value node: DOMNode y=x.childNodes[0];

change the value of this node: y.nodeValue="New Value";

0

精彩评论

暂无评论...
验证码 换一张
取 消