Z
Zombie
hello,
I am generating an XML document at run time.
I have been able to create the root element and the elements below it
but I am not able to add attributes to elements. Can anyone please
send a snippet on how to do this?
Thanks.
The sample code I am using is:
----------------------------------------------------
HRESULT hr;
IXMLDOMDocument2Ptr pXMLDoc;
IXMLDOMNodePtr pNode;
IXMLDOMProcessingInstructionPtr pi;
hr = pXMLDoc.CreateInstance("Msxml2.DOMDocument.4.0");
pi = pXMLDoc->createProcessingInstruction("xml", "version=\"1.0\"");
pXMLDoc->appendChild(pi);
pNode = pXMLDoc->createNode("1", "root", "");
pXMLDoc->appendChild(pNode);
pNode = pXMLDoc->createNode("1", "element1", "");
pXMLDoc->documentElement->appendChild(pNode);
------------------------------------------------------
I am generating an XML document at run time.
I have been able to create the root element and the elements below it
but I am not able to add attributes to elements. Can anyone please
send a snippet on how to do this?
Thanks.
The sample code I am using is:
----------------------------------------------------
HRESULT hr;
IXMLDOMDocument2Ptr pXMLDoc;
IXMLDOMNodePtr pNode;
IXMLDOMProcessingInstructionPtr pi;
hr = pXMLDoc.CreateInstance("Msxml2.DOMDocument.4.0");
pi = pXMLDoc->createProcessingInstruction("xml", "version=\"1.0\"");
pXMLDoc->appendChild(pi);
pNode = pXMLDoc->createNode("1", "root", "");
pXMLDoc->appendChild(pNode);
pNode = pXMLDoc->createNode("1", "element1", "");
pXMLDoc->documentElement->appendChild(pNode);
------------------------------------------------------