使用MSXML读取NodeMap时自动更改值 [英] Auto change value when read NodeMap with MSXML

查看:116
本文介绍了使用MSXML读取NodeMap时自动更改值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨所有

我有一个bug,显示为

hi all
i have a bug, show as after

MSXML::IXMLDOMNamedNodeMapPtr spNameNodeMap = spNode->attributes;
 for (long j = 0; j < spNameNodeMap->length; j++)
   {
      MSXML::IXMLDOMNodePtr spNode2 = spNameNodeMap->item[j];
      if (spNode2->nodeName == (_bstr_t)"index"){
              index = (_bstr_t)spNode2->nodeValue;
      }
      else if (spNode2->nodeName == (_bstr_t)"weight"){
              weight = (_bstr_t)spNode2->nodeValue;
      }
   }



所以,经过编译...索引和重量的值是相同的

当我调试这个错误!

i显示变量索引是地址内存!并且,当我们更改权重值时,该地址内存的值将自动更改(使用j ++循环)

和退出循环时,索引和权重的值为false,并且xml文件的数据为

如何修复它


so, after compiled...value of index and weight is equally
when i debug this error !
i show variable index is address memory! And, value of that address memory will auto change when we change value of weight (loop with j++)
and when exit loop, value of index and weight is false with data of xml file
how do what to fix it

推荐答案

我找到了问题原因

i必须更改index的类型变量从 LPCTSTR _bstr_t 的重量

数据没有变化

之后,我有来自xml的数据文件,我将类型 _bstr_t 转换为 BSTR 并插入链接的列表以保存它

非常感谢阅读我的主题
i had find cause of problem
i have to change type variable of "index" and "weight" from LPCTSTR to _bstr_t
data is not change
after that, i have data from xml file, i convert type _bstr_t to BSTR and insert into a list linked to save it
thanks so much for read my topic


这篇关于使用MSXML读取NodeMap时自动更改值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆