MSXML。获取 Base64 格式的数据
我将 C++ 与 MSXML 结合使用,并希望从 XML 文件中获取 Base64 数据。我正在使用这段代码:
hr = nodeList->get_item((long)i, (IXMLDOMNode **)&vXMLNode);
if ( FAILED(hr) )
throw "Unable to retrieve child node";
vXMLNode->put_dataType(_bstr_t("bin.base64"));
hr = vXMLNode->get_nodeTypedValue(&varValue);
if ( FAILED(hr) )
throw "Unable to retrieve 'xmltext' text";
所以 vXMLNode
是一个带有数据的子节点。 vXMLNode
的节点类型为 NODE_ELEMENT
。如果我检查此节点的数据类型,我会得到VT_NULL
。因此我将数据作为字符串获取。
我的代码有什么问题?
I'm using C++ with MSXML and want to get data from XML file as Base64. I'm using this code:
hr = nodeList->get_item((long)i, (IXMLDOMNode **)&vXMLNode);
if ( FAILED(hr) )
throw "Unable to retrieve child node";
vXMLNode->put_dataType(_bstr_t("bin.base64"));
hr = vXMLNode->get_nodeTypedValue(&varValue);
if ( FAILED(hr) )
throw "Unable to retrieve 'xmltext' text";
So vXMLNode
is a child node with data. Node type of vXMLNode
is NODE_ELEMENT
. If I check data type for this node, I get VT_NULL
. Therefore I get my data as a string.
What is wrong in my code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信问题出在您提供的示例代码之外。这是一个使用nodeTypedValue 的工作控制台程序。我希望这有帮助。
I believe the problem lies outside of your supplied sample code. Here's a working console program that uses nodeTypedValue. I hope this helps.