|
-
May 15th, 2002, 06:41 AM
#1
XML with C++
has anybody worked in XML with C++
i have written following code and i don't know why it's not working
#include "stdafx.h"
#include "stdio.h"
#include "atlbase.h"
#import "msxml3.dll"
using namespace MSXML2;
inline void EVAL_HR( HRESULT _hr )
{ if FAILED(_hr) throw(_hr); }
int main(int argc, char* argv[])
{
USES_CONVERSION;
try
{
IXMLDOMDocumentPtr objDOMDoc;
EVAL_HR(CoInitialize(NULL));
EVAL_HR(objDOMDoc.CreateInstance("Msxml2.DOMDocument.3.0"));
_variant_t varXml("C:\\Sample.xml");
_variant_t varOut((bool)TRUE);
objDOMDoc->async = false;
varOut = objDOMDoc->load(varXml);
IXMLDOMNode *NewNode;
NewNode = objDOMDoc->createElement("Location");
objDOMDoc->documentElement->appendChild(NewKid);
and this statement appendchild gives me exception
following is my XML file
<?xmlversion ='1.0' encoding='utf-8'?>
<Sample>
<child>"remove this node"</child>
</Sample>
please help me.
it's urgent.
anu
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|