IXSLTemplate::putref_stylesheet 返回 E_INVALIDARG

发布于 2024-09-18 00:11:44 字数 771 浏览 0 评论 0原文

好吧,我已经迷路了几个小时...

IXSLTemplate::putref_stylesheet 没有记录除 E_FAIL 之外的任何错误。

但在我的例子中,putref_stylesheet 返回E_INVALIDARGGetErrorInfo() 只是告诉我“参数无效”是多余的。所以我没有留下太多信息。

不过,我的代码与我在网络和 msdn 上找到的所有示例非常接近。 它的作用如下:

void xsltProcessing(MSXML2::IXMLDOMDocument* pXmlDoc, MSXML2::IXMLDOMDocument * pXslDoc)
{
    IXSLTemplatePtr pTemplate;
    pTemplate.CreateInstance( _T( "Msxml2.XSLTemplate" ));
    pTemplate->putref_stylesheet(pXslDoc);
    //...
}

因为 putref_stylesheet 没有太多文档。您知道它返回 E_INVALIDARG 可能会出现什么问题吗?

我的 pXslDoc 是一个 IXMLDOMDocument 我已成功从静态 const 字符串加载。

有什么线索吗? (我想这是一个相当模糊的问题,但我已经搜索了几个小时了)

Well, it's been several hours I'm lost...

IXSLTemplate::putref_stylesheet doesn't document any error except E_FAIL.

However in my case putref_stylesheet returns E_INVALIDARG. GetErrorInfo() is only redundant telling me that the "Argument is invalid". So I am not left with much information.

However my code is pretty close to all examples I found on the web and msdn.
And it does something like:

void xsltProcessing(MSXML2::IXMLDOMDocument* pXmlDoc, MSXML2::IXMLDOMDocument * pXslDoc)
{
    IXSLTemplatePtr pTemplate;
    pTemplate.CreateInstance( _T( "Msxml2.XSLTemplate" ));
    pTemplate->putref_stylesheet(pXslDoc);
    //...
}

As there is not much documentation for putref_stylesheet. Do you have any idea what could go wrong for it to return E_INVALIDARG ?

My pXslDoc is a IXMLDOMDocument I have loaded from static const strings with success.

Any clue ? ( I guess it's pretty vague a question, but it's been hours I am searching )

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

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

发布评论

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

评论(1

乖乖 2024-09-25 00:11:44

您是否异步加载 pXslDoc

IXMLDOMDocument 对象的默认行为是异步加载,因此当您调用 putref_stylesheet() 时,pXslDoc 可能尚未完成加载。

如果您遇到了这个问题,在加载 pXslDoc 之前添加以下代码可以解决此问题:

pXslDoc->put_async(VARIANT_FALSE);

Are you loading pXslDoc asynchronously perhaps?

The default behaviour for IXMLDOMDocument objects is to load asynchronously, so it is possible that the pXslDoc has not finished loading when you call putref_stylesheet().

Adding the following code before you load pXslDoc would fix this problem, if it is what you are suffering from:

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