Fog Creek Software
Discussion Board




COM & XML question

How do I pass a IXMLDOMDocument parameter to my ATL com object?

This bug causes me problems.

http://support.microsoft.com/default.aspx?scid=kb;en-us;316317

Anyone successfully passed a IXMLDomDocument (or any other reference from the msxml) to a com object (across execution contexts)?

Best regards

Göran
Wednesday, August 25, 2004

Can you not serialise it, send it as a string, and then reload it into a DOM document at the other end ?

Tom
Wednesday, August 25, 2004

Tom, I hope I should never use your application.


Wednesday, August 25, 2004

Hm, how do you define 'execution context'?

The knowledge base article says something about problems with wrappers classes generated by #import directive.

If 'excution context' is a DLL in the same appartment, then you can pass a interface pointer (COM) , instead of a pointer to smart pointer object (C++). AFAIK GetInterfacePtr returns pointer to raw interface,

If 'execution context' means appartment, then knowledge base article does not mention problems with marshalling, i guess they have some default marshaller for this interface.

Michael Moser
Wednesday, August 25, 2004

The problem is that you need to precede the IXMLDOMDocument typ with 'MSXML2::'

I can't do this in the IDL file (it doesn't know what MSXML2:: is), so I get compiler errors when the IDL is transformed into a c++ file.

Göran
Wednesday, August 25, 2004

Anonymous

Why not ?

Our application is a logistics system for a major motor manufacturer, runs 200 users in 5 countries on a dozen servers, and relies entirely on shipping XML documents as strings between components, processes and servers.

Can you justify your comment please ?

Tom
Wednesday, August 25, 2004

MSXML2:: is a C++ namespace.

#import generates two header files, <dll_name>.tli and <dll_name>.tlh. Both are in the directory where the *.obj and other temporary files are

By default the declarations in these implicit headers is placed into a namespace of its own.

#import <some_dll> no_namespaces
will generate headers without namespaces.

Michael Moser
Wednesday, August 25, 2004

200 users on a dozen server, that's ~17 users per server. That's a justification.

 
Wednesday, August 25, 2004

5 Server Citrix Farm
Clustered pair of Interacticve Application servers
Clustered pair of Batch Application servers
Clustered pair of SQL Servers
File and print server

Stop talking out of your ass and justify your original comment.

Tom
Wednesday, August 25, 2004

Anonymous -
Sometimes you have to do nasty stuff like that in order to get the app to work.

We've found that you can't reliably pass a IXMLDOMDocument from an ASP page to the VB code behind it -- works most of the time, but occasionally it craps out (our site gets 5 million hits/day, so any "occasional" error shows up pretty frequently).  So we had to pass it as a string, as passing the fundamental datatypes works every time.

example
Wednesday, August 25, 2004

> justify your original comment

A lot of coders have a problem with the apparent verboseness of XML since the tag name is repeated at the beginning and end of the tag. Basically, premature optimization.

Matthew Lock
Wednesday, August 25, 2004

I'll agree that XML can be inefficient space wise when stored as a string.  In our case this was not a problem, most of the XML fragements that we move around are a few 10s of Kb, and we are running on Gbit ethernet.

We did investigate the use of compression, both generic and XML specific ( http://www.research.att.com/sw/tools/xmill ), but the overhead at each end in most cases did was greater than the actual time to marshall the string.

Tom
Wednesday, August 25, 2004

*  Recent Topics

*  Fog Creek Home