Wince MSXML3.0 解析错误

来源:互联网 发布:淘宝新开店铺提取软件 编辑:程序博客网 时间:2024/04/28 16:30

从上周五开始在WinCE6.0平台下使用MSXML3.0来解析XML格式的配置文件,但是出现一个很莫名其妙的问题,就是使用xDocument->SelectNodes一直不成功,但是使用xDocument->get_xml查看得到的整个文件的xml文本时发现都是正确的,所以百思不得其解。

后来,Goole了很多文档,终于查到(http://blogs.msdn.com/b/cenet/archive/2005/09/01/459476.aspx):

A common error some Windows CE developers hit when using MSXML is that they call into some functionality and they get a not implemented error (E_NOTIMPL=0x80004001) when the CE Docs say the feature is supported.  In particular, people hit this a lot when doing a query (xmlDom.selectNodes(), selectSingleNode(), getElementsByTagName()) or when transforming nodes (xmlDom.transformNode).

The problem is that the CE MSXML is extremely componentized, such that you only get the particular features that you want.  So you may have built an MSXML with the DOM feature only, not the additional features you need to make the above calls work, and hence E_NOTIMPL.  For querying XML, you need to have your image built with SYSGEN_MSXML_XQL.  For transforming nodes, you'll also need SYSGEN_MSXML_XSLT.

This problem is easy to fix if you're an OEM, a little trickier if you're an ISV working with an OEM.  (This problem doesn't affect PocketPC / Smartphone developers in the first place for various reasons.)  See here for information about how you can add system level components to your device.

原文不翻译了,大概的意思是,要使用SelectNodes等查询方法,那么必须将SYSGEN_MSXML_XQL组件加入,不然无法查询。

 

2010.12.15 追加

但是,如果在WinCE6.0的模拟器上运行的话,还是不成功。如果换成实际设备,则没有问题。到时候花点时间看看到底是什么问题。