为什么 IXSLTemplate::putref_stylesheet 在传递 IXMLDOMDocument 参数时进行编译

发布于 2024-09-18 05:09:12 字数 887 浏览 1 评论 0原文

我第一次使用 XSLT 和 MSXML2。当然它不起作用:-) 我有一个我无法解决的错误。

为了修复这个错误,我尝试了解周围的一切:有些事情让我震惊。

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

它编译起来轻而易举,而这是 putref_stylesheet 的定义

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

,我还没有找到任何接受 IXMLDOMDocument * 作为参数的定义。

这怎么可能编译?这两种类型根本不匹配!

任何帮助表示赞赏。

我发现这两个链接也在其代码中传递 xmldocuments!: 示例一 示例二

I am playing with XSLT with MSXML2 for the first time. And of course it doesn't work :-)
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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

陈甜 2024-09-25 05:09:12

IXMLDOMDocument 根据 MSDN.因此,它与将派生类指针传递给需要基类指针的类相同。因此它可以编译。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文