s***@inbox.ru
2006-12-20 07:17:10 UTC
Hi, Everyone!
I wish to post a solution to a problem listed in another 3 years old
topic, wich hasn't yet been described and thus is not available for
those who still faces it.
The error was:
===================================================================
I am getting a "C2039: 'attributes' : is not a member
of 'IXMLDOMNode'
c:\relcalc\relcalc\debug\msxml4.tlh(332) : see
declaration of 'IXMLDOMNode' " compile time error when I
try to call the function in the following code:
#import <msxml4.dll> raw_interfaces_only
using namespace MSXML2;
int NIModule::createXMLFile(char * inputArr[])
{
IXMLDOMDocument *pXMLDom=NULL;
IXMLDOMNode *pRoot=NULL;
IXMLDOMAttribute *pa=NULL;
VARIANT var;
BSTR bstr = NULL;
BSTR bstr1 = NULL;
// Create the root element.
bstr = SysAllocString(L"ns1:netInventory");
bstr1 = SysAllocString(L"http://netml");
pXMLDom->createNode(var, bstr, bstr1, &pRoot);
SysFreeString(bstr);
bstr = NULL;
SysFreeString(bstr1);
bstr1 = NULL;
// Create a "xsi:schemaLocation" attribute
bstr = SysAllocString(L"schemaLocation");
var = VariantString(L"http://");
pXMLDom->createAttribute(bstr,&pa);
pa->put_value(var);
pRoot->attributes->setNamedItem(pa);
}
===================================================================
So the solution is to delete "using namespace MSXML2;" and to use
"MSXML2::"-prefix instead.
Best regards,
Jure
I wish to post a solution to a problem listed in another 3 years old
topic, wich hasn't yet been described and thus is not available for
those who still faces it.
The error was:
===================================================================
I am getting a "C2039: 'attributes' : is not a member
of 'IXMLDOMNode'
c:\relcalc\relcalc\debug\msxml4.tlh(332) : see
declaration of 'IXMLDOMNode' " compile time error when I
try to call the function in the following code:
#import <msxml4.dll> raw_interfaces_only
using namespace MSXML2;
int NIModule::createXMLFile(char * inputArr[])
{
IXMLDOMDocument *pXMLDom=NULL;
IXMLDOMNode *pRoot=NULL;
IXMLDOMAttribute *pa=NULL;
VARIANT var;
BSTR bstr = NULL;
BSTR bstr1 = NULL;
// Create the root element.
bstr = SysAllocString(L"ns1:netInventory");
bstr1 = SysAllocString(L"http://netml");
pXMLDom->createNode(var, bstr, bstr1, &pRoot);
SysFreeString(bstr);
bstr = NULL;
SysFreeString(bstr1);
bstr1 = NULL;
// Create a "xsi:schemaLocation" attribute
bstr = SysAllocString(L"schemaLocation");
var = VariantString(L"http://");
pXMLDom->createAttribute(bstr,&pa);
pa->put_value(var);
pRoot->attributes->setNamedItem(pa);
}
===================================================================
So the solution is to delete "using namespace MSXML2;" and to use
"MSXML2::"-prefix instead.
Best regards,
Jure