Vojtech
Vojtech

Reputation: 2603

IXMLDOM does not recognize XPath last() function?

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

Upvotes: 4

Views: 691

Answers (1)

RRUZ
RRUZ

Reputation: 136391

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 MSXML

try

Doc := CreateOleObject('Msxml2.DOMDocument.6.0') as IXMLDomDocument;

Upvotes: 5

Related Questions