Pau
2005-06-27 11:34:03 UTC
Hi!
I'm trying to create a new XML node with the MSXML4.0 methods in a VC++ 6.0
environment. I thought that it was a simply thing, but seems that is not the
situation.
First I supose that with a new IXMLDOMElement or IXMLDOMNode it was possible
to do it, but they have not a default constructor and I've been not capable
to create a new and empty node or element with these objects.
Then, after some searches, I started with the IXMLDOMDocument object, which
has a method called 'createNode', and here I faced with some diferences
between the MSXML documentation and the VC++ IDE. In the doc, the method call
is like this:
HRESULT createNode( VARIANT Type, BSTR name, BSTR namespaceURI,
IXMLDOMNode **node);
but in the VC++, when I try to use it according to the former description,
the IDE says to me that "The function doesn't take these parameters", and
only shows to me a version of create node that takes this format:
IXMLDOMNode createNode(const variant_t & type, _bstr_t name, _bstr_t
namespaceURI);
which crashes always.
Debbuging it step by step, I can see that in the Debug\msxml4.tli this code:
inline MSXML2::IXMLDOMNodePtr MSXML2::IXMLDOMDocument::createNode ( const
_variant_t & type, _bstr_t name, _bstr_t namespaceURI ) {
struct IXMLDOMNode * _result;
HRESULT _hr = raw_createNode(type, name, namespaceURI, &_result);
if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
return IXMLDOMNodePtr(_result, false);
}
where the _result variable is never allocated and I supose that this is the
reason of the 'Access Violation' error that raises always when I run my
program. The crash appears in the raw_createNode call.
So, has someone created xml nodes in a Visual C++ 6.0 environment with the
MSXML 4.0 sdk? It's so difficult or I'm finding problems where nobody has
found?
It's possible to create xml nodes without using the IXMLDOMDocument object?
Thanks for your help.
pau.
I'm trying to create a new XML node with the MSXML4.0 methods in a VC++ 6.0
environment. I thought that it was a simply thing, but seems that is not the
situation.
First I supose that with a new IXMLDOMElement or IXMLDOMNode it was possible
to do it, but they have not a default constructor and I've been not capable
to create a new and empty node or element with these objects.
Then, after some searches, I started with the IXMLDOMDocument object, which
has a method called 'createNode', and here I faced with some diferences
between the MSXML documentation and the VC++ IDE. In the doc, the method call
is like this:
HRESULT createNode( VARIANT Type, BSTR name, BSTR namespaceURI,
IXMLDOMNode **node);
but in the VC++, when I try to use it according to the former description,
the IDE says to me that "The function doesn't take these parameters", and
only shows to me a version of create node that takes this format:
IXMLDOMNode createNode(const variant_t & type, _bstr_t name, _bstr_t
namespaceURI);
which crashes always.
Debbuging it step by step, I can see that in the Debug\msxml4.tli this code:
inline MSXML2::IXMLDOMNodePtr MSXML2::IXMLDOMDocument::createNode ( const
_variant_t & type, _bstr_t name, _bstr_t namespaceURI ) {
struct IXMLDOMNode * _result;
HRESULT _hr = raw_createNode(type, name, namespaceURI, &_result);
if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
return IXMLDOMNodePtr(_result, false);
}
where the _result variable is never allocated and I supose that this is the
reason of the 'Access Violation' error that raises always when I run my
program. The crash appears in the raw_createNode call.
So, has someone created xml nodes in a Visual C++ 6.0 environment with the
MSXML 4.0 sdk? It's so difficult or I'm finding problems where nobody has
found?
It's possible to create xml nodes without using the IXMLDOMDocument object?
Thanks for your help.
pau.