I try to set an attribute in a XML node using MSXML. IXMLDOMElement alone has the member function setAttribute. So I got the document element.
pXMLDocumentElement -> get_documentElement (& pElement );
pElement -> selectSingleNode ( nodePathString ,& pNode );
.
.
.
pElement -> setAttribute ( bstr , var );
I selected the required node in which the attribute has to be set using selectSingleNode function. After selecting the required node, I tried to set attribute.
But the PElement pointer does not shift to the required node. It stayed on the root node. Result: added the attribute in root itself.
Is there any way, I can shift my PElement to the node resulted in selectSingleNode function? So that I can set the attribute.
I think you have to use the
setAttributeNodeAPI on yourpNodepointer.While you are at it read this tutorial on using MSXML. And after you have the basics covered this blog.