IXMLDOM does not recognize XPath last () function?

Good afternoon! I work with the Delphi 2009 library and MSXML2_TLB (IXMLDOM). I need to select the latest node assembly:

Doc := CreateOleObject('Microsoft.XMLDOM') as IXMLDomDocument; Doc.loadXML(XmlStr); tmpNode:= Doc.selectSingleNode('//Meeting[last()]'); 

But in the last line of the above code, I get an exception:

 Project test.exe raised exception class EOleException with message: 'Unknown method //Meeting[-->last()<--]' 

Is there a way to select the last node using xpath or do I really need to write code to get a list of node and then select the last element?

Version Information:

 Type Lib: C:\WINDOWS\system32\msxml6.dll (1) LIBID: {F5078F18-C551-11D3-89B9-0000F81FE221} HelpString: Microsoft XML, v6.0 

Thank you in advance! Voitech

+4
source share
1 answer

This is because you are using the msxml version where the last function is not defined, as far as I know, this function was introduced in version 4.0 of MSXML

to try

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

Source: https://habr.com/ru/post/1395270/


All Articles