IXMLDOM 无法识别 XPath last() 函数?
再会!我正在使用 Delphi 2009 和 MSXML2_TLB 库 (IXMLDOM)。我需要选择最后一个会议节点:
Doc := CreateOleObject('Microsoft.XMLDOM') as IXMLDomDocument;
Doc.loadXML(XmlStr);
tmpNode:= Doc.selectSingleNode('//Meeting[last()]');
但是在上面代码的最后一行我得到异常:
Project test.exe raised exception class EOleException with message: 'Unknown method
//Meeting[-->last()<--]'
有没有办法如何使用 xpath 选择最后一个节点,或者我真的必须编写代码来获取节点列表,然后选择最后一个元素?
还有版本信息:
Type Lib: C:\WINDOWS\system32\msxml6.dll (1)
LIBID: {F5078F18-C551-11D3-89B9-0000F81FE221}
HelpString: Microsoft XML, v6.0
先谢谢您!沃伊泰克
Good day! I'm working with Delphi 2009 and MSXML2_TLB library (IXMLDOM). I need to select the last Meeting node:
Doc := CreateOleObject('Microsoft.XMLDOM') as IXMLDomDocument;
Doc.loadXML(XmlStr);
tmpNode:= Doc.selectSingleNode('//Meeting[last()]');
But on the last line of the code above I get exception:
Project test.exe raised exception class EOleException with message: 'Unknown method
//Meeting[-->last()<--]'
Is there a way how to select the last node using xpath or do I really have to write code to get node list and then select the last element?
Yet a version info:
Type Lib: C:\WINDOWS\system32\msxml6.dll (1)
LIBID: {F5078F18-C551-11D3-89B9-0000F81FE221}
HelpString: Microsoft XML, v6.0
Thank you in advance! Vojtech
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是因为您使用的 msxml 版本中未定义
last
函数,据我所知,该函数是在 MSXML v 4.0 中引入的
This is because you are using a version of msxml where the
last
function is not defined, as far I know this function was introduced in the v 4.0 of MSXMLtry