IXSLTemplate::putref_stylesheet 返回 E_INVALIDARG
好吧,我已经迷路了几个小时...
IXSLTemplate::putref_stylesheet
没有记录除 E_FAIL 之外的任何错误。
但在我的例子中,putref_stylesheet
返回E_INVALIDARG
。 GetErrorInfo()
只是告诉我“参数无效”是多余的。所以我没有留下太多信息。
不过,我的代码与我在网络和 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否异步加载
pXslDoc
?IXMLDOMDocument
对象的默认行为是异步加载,因此当您调用putref_stylesheet()
时,pXslDoc
可能尚未完成加载。如果您遇到了这个问题,在加载
pXslDoc
之前添加以下代码可以解决此问题:Are you loading
pXslDoc
asynchronously perhaps?The default behaviour for
IXMLDOMDocument
objects is to load asynchronously, so it is possible that thepXslDoc
has not finished loading when you callputref_stylesheet()
.Adding the following code before you load
pXslDoc
would fix this problem, if it is what you are suffering from: