Return XmlDocument using C# interop

B

Bart Roozendaal

Hi,

I have setup a (my first) C# assembly. I am using the COM Interop services
to use the assembly from a Delphi program.

Is there a way to return a XmlDomDocument object from the assembly to the
Delphi program? If I try to return the XmlDocument object itself, I get an
error like:

This type has a ComVisible(false) parent in its hierarchy.

I've now chosen to return the OuterXml of the document and restoring the
object in the Delphi-program, but that seems like one step too many and costs
additional resources and processing time.

Is there some way to pass the XmlDocument to the Delphi program?

Please be aware: these are my first steps into C# and .NET so please forgive
me if it's a stupid question :)

Bye,
Bart Roozendaa
 
N

Nicholas Paldino [.NET/C# MVP]

Bart,

If the XmlDocument is not labeled for COM interop, then you won't be
able to pass that object. Since it is not your object, you can't change the
definition either.

You might want to use MSXML in your objects, and expose that, since it
is a COM object. Then, you could pass it to your Delphi program, which can
use the MSXML parser that you are exposing.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top