Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XML- Add child element

From: "Joe Fawcett" <joefawcett@---------.------>
To: 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 



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent