Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help: How to use msxml from C++

240 views
Skip to first unread message

Jens L

unread,
Apr 21, 1999, 3:00:00 AM4/21/99
to
Could someone tell me how to simple invoke the msxml from VC6. I tried
#import"msxml.dll" (even #include "msxml.tlh";#include "msxml.tli"), but all
DOM interfaces (e.g., IXMLDOMDocument) are still undefined.

Any recipe would be very much appreciated. The msdn XML & C++ samples are
not very helpful, since they don't compile.

Thanks

Jens

bob thickens

unread,
Apr 21, 1999, 3:00:00 AM4/21/99
to
see:http://msdn.microsoft.com/workshop/xml/xmldom/scriptref/xmldom_objects.a
sp
it has some sample code

Jens L <lipp...@micromodeling.com> wrote in message
news:e5udL4Dj#GA.266@cppssbbsa03...

Jens L

unread,
Apr 22, 1999, 3:00:00 AM4/22/99
to

The only C++ sample there does not compile. Seems like C++ does not get a
whole lot of attention in the sitebuilder area of msdn.
Did anyone tried to use the DOM (msxml 2.0) from VC?

Jens


bob thickens <bo...@electroniclaim.com> wrote in message
news:eAxed9Gj#GA....@cppssbbsa02.microsoft.com...

Christian Staffe

unread,
Apr 22, 1999, 3:00:00 AM4/22/99
to

Jens L <lipp...@micromodeling.com> wrote in message
news:#yKmYzLj#GA.263@cppssbbsa03...

>
> The only C++ sample there does not compile. Seems like C++ does not get a
> whole lot of attention in the sitebuilder area of msdn.
> Did anyone tried to use the DOM (msxml 2.0) from VC?
>
> Jens

Here is a short sample using #import that should save the following XML
stream in the test.xml file : <document><tag name="value"/></document>

And now the magic :

#import "msxml.dll"

int main(int argc, char* argv[])
{
CoInitialize(0);

MSXML::IXMLDOMDocumentPtr pDoc;
HRESULT hr = pDoc.CreateInstance(__uuidof(MSXML::DOMDocument));

MSXML::IXMLDOMElementPtr pElement = pDoc->createElement("document");
pDoc->appendChild(pElement);
pElement = pDoc->createElement("tag");
_variant_t value("value");
pElement->setAttribute("name",&value);
pDoc->documentElement->appendChild(pElement);
_variant_t dest("c:\\test.xml");
pDoc->save(&dest);
pElement.Release();
pDoc.Release();

CoUninitialize();

return 0;
}

Hope this helps

Christian

Alexey Trenikhin

unread,
Apr 26, 1999, 3:00:00 AM4/26/99
to
I use #import "msxml.dll" rename_namespace("msxml"), it works.
May be you forgot for namespace ( msxml::IXMLDOMDocument instead
IXMLDOMDocument in my case)

Al.

Jens L <lipp...@micromodeling.com> wrote in message
news:#yKmYzLj#GA.263@cppssbbsa03...
> The only C++ sample there does not compile. Seems like C++ does not get a
> whole lot of attention in the sitebuilder area of msdn.
> Did anyone tried to use the DOM (msxml 2.0) from VC?
>
> Jens
>
>

> bob thickens <bo...@electroniclaim.com> wrote in message
> news:eAxed9Gj#GA....@cppssbbsa02.microsoft.com...
> >
>
see:http://msdn.microsoft.com/workshop/xml/xmldom/scriptref/xmldom_objects.a
> > sp
> > it has some sample code
> >

> > Jens L <lipp...@micromodeling.com> wrote in message

0 new messages