开发者

why is that IXSLTemplate::putref_stylesheet compile when passed an IXMLDOMDocument argument

开发者 https://www.devze.com 2023-01-14 22:08 出处:网络
I am playing with XSLT with MSXML2 for the first time. And of course it doesn\'t work :-)开发者_StackOverflow社区

I am playing with XSLT with MSXML2 for the first time. And of course it doesn't work :-)开发者_StackOverflow社区 I have a bug which I cannot figure to solve.

So as to fix the bug, I try to understand everything around: and something shocks me.

void xsltProcessing(IXMLDOMDocument* pXmlDoc, IXMLDOMDocument * pXslDoc)
{
    CComPtr<IXSLTemplate> pTemplate;
    pTemplate.CoCreateInstance(CLSID_XSLTemplate);
    pTemplate->putref_stylesheet(pXslDoc);
    //...
}

it compiles like a breeze whereas this is the definition of putref_stylesheet

  virtual HRESULT __stdcall putref_stylesheet (
    /*[in]*/ struct IXMLDOMNode * stylesheet ) = 0;

and I haven't found any definition that would accept a IXMLDOMDocument * as a parameter.

How is that possible to compile ? the two types simply don't match !

any help appreciated.

I have found these two links that also pass xmldocuments in their code !: Example One Example Two


IXMLDOMDocument is derived from IXMLDOMNode according to MSDN. Hence it is same as passing a derived class pointer to a class expecting a base class pointer. Hence it compiles.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号