Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - XML- Add child element [Thread Next] Re: XML- Add child elementTo: NULL Date: 6/7/2008 9:57:00 AM "Popu" <Popu@d...> wrote in message news:4A71A720-64D2-49AE-8D3F-C2D2BBDBFADB@m...... > Hi, I am working with C++ and MSXML 6.0, I am able to read and write(new) > an > XML file, but I am not able to edit using MSXML. > For ex: To add a child element to my existing XML file I: > > Load the xmldoc: hr = pXMLDoc->load(bstrFileName,&isSuccess); > ... > hr = pXMLDoc->selectSingleNode(bstr, &pXMLNode); > NodeType = VariantToType(NODE_ELEMENT); > hr = pXMLDoc->createNode(NodeType,bstr,NULL,&pXMLChildNode); > hr = pXMLNode->appendChild(pXMLChildNode,&pXMLInsertedNode); > > > I am getting an error here. I am not able to append child to the node > which > i got from the selectsinglenode method. > any help is appreciated. > > I don't really understand C++ but are you sure selectSingleNode is populating pXmlNode? For that bstr would have to be valid and correct XPath and in the later lines it would have to be the name of the new node. -- Joe Fawcett (MVP - XML) http://joe.fawcett.name | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
