Beginner #import questions 
Author Message
 Beginner #import questions

I #imported the msxml.dll typelib into a console project to play a little
with the IE5 xml parser from VC++.

Hating to type "xml::" or similar every time, I tried "no_namespace" at
first.

This gives a whole load of errors, most of them redeclaration
(class->struct).

Second try was to do a "using namespace MSXML;" after the #import.
This works, and I can do simple parsing and xml creation.

Then I tried to make some helper functions to construct "element" tags and
return them using IXMLDOMElement* parameters. Now the compile fails again:
the compiler gives "ambiguous symbol" and then can't find some methods of
some MSXML interfaces.

I have added some include files and libraries to the VC++ directories
settings. The order is:
-MSXMLSDK (MSXML 2.6 parser)
-IE5                (IE5 headers)
-Platform SDK

Everything works like it should when I use a namespace for the typelib
import.

So what gives? Is there a simple declaration issue I don't see?
Are some older msxml.h headers making trouble?

Any suggestions appreciated,
Taras



Wed, 31 Jul 2002 03:00:00 GMT  
 Beginner #import questions

Quote:

> Hating to type "xml::" or similar every time...

This is a beginner namespace question. Don't use "no_namespace".
Don't use "using namespace MSXML;". And get the MSXML.H headers from
the Platform SDK (or the IE5 libraries and headers), so you don't
need to #import.

Then for each identifier you need, insert it once into the current
scope:

    using MSXML::IXMLDOMElement;

Quote:
> Are some older msxml.h headers making trouble?

Probably yes. But the trouble actually comes because VC++ can't
resolve multiple lookup paths thru 'using namespace' into the same
namespace very well.

--
 Phlip
======= http://users.deltanet.com/~tegan/home.html =======



Wed, 31 Jul 2002 03:00:00 GMT  
 Beginner #import questions
Phlip, thanks, my words inline..

Quote:
>This is a beginner namespace question. Don't use "no_namespace".
>Don't use "using namespace MSXML;". And get the MSXML.H headers from
>the Platform SDK (or the IE5 libraries and headers), so you don't
>need to #import.
>Then for each identifier you need, insert it once into the current
>scope:
>    using MSXML::IXMLDOMElement;

When I import "msxml.h", where does this "MSXML" namespace come from?

But are you saying I should drop the use of #import COM-wrappers completely?
I am rather {*filter*}ed to the use of retval and property wrappers. =)

Quote:
>Probably yes. But the trouble actually comes because VC++ can't
>resolve multiple lookup paths thru 'using namespace' into the same
>namespace very well.

Could you say some more about this? I believe there is just one 'library'
namespace ("MSXML/MSXML2") that I include completely. What are the 'multiple
lookup paths' in this case?

Thanks again,
Taras



Wed, 31 Jul 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Importing classes from a dll- beginner question..again.

2. Beginner - Importing various graphic formats

3. array question - beginner question

4. Newbie question: C++ beginner question

5. Trouble with MIDL import and #import

6. Can't import com interface using #import

7. lint question - how to "import" VARARGS

8. a simple question on raw method with #import Mylib.tlb

9. IDL question - import "msxml2.idl";

10. #import & LPTSTR Question

11. #import and raw pointers question

12. #import question.

 

 
Powered by phpBB® Forum Software