inheritance in active x interfaces

For questions and postings not covered by the other forums
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

inheritance in active x interfaces

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:07 pm

by CarlRanson >> Tue, 7 May 2002 22:16:35 GMT

Hi All,

Just trying to import the XML 4 active x library and I've come up against a snag.

As far as i can tell, Jade doesn't seem to deal with inheritance in the activeX interfaces. They are all descended from IDispatch.

ie. It doesnt know that IXMLDOMCDATASection inherits from IXMLDOMText which inherits from IXMLDomCharacterData which inherits from IXMLDOMNode etc.

This, of course, breaks down when you try to pass a descendant (say IXMLDomText) into a function that expects and IXMLDOMNode.

Does Jade provide some workaround that im just missing here?

CR

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: inheritance in active x interfaces

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:08 pm

by cdshearer >> Wed, 8 May 2002 0:08:13 GMT

Hi Carl

I think Wilfred and others have pointed out this problem. As far as I know, there is no workaround!

Craig

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: inheritance in active x interfaces

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:08 pm

by CarlRanson >> Thu, 9 May 2002 1:32:11 GMT

In the interest of helping others who will face this problem, I can now answer my own question.

Although its not clear from the help, jade does provide a facility to work around this issue.

testXML();

vars
domDocument : DOMDocument40;
domNode : IXMLDOMNode;
commentNode : IXMLDOMComment;begin

create domDocument transient;
domDocument.loadXML('<foo><bar>this is a test</bar></foo>');

commentNode := domDocument.createComment('This is comment text');
domNode := commentNode.getInterface(IXMLDOMNode).IXMLDOMNode;
domNode.text := 'This is a different comment';

domDocument.firstChild.appendChild(domNode);
write domDocument.xml;
delete domDocument;
end;

will output the correct text:
<foo><bar>this is a test</bar><!--This is a different comment--></foo>

so

if X is a interface variable of type Z and Y is another interface variable of any type then
X := Y.getInterface(Z).Z;

is roughly equivalent to the typecast
X := Y.Z

except that it is type-un-safe...i.e. checked at runtime.

CR


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest

cron