This works in my XPath example in Delphi XE2 and the Delphi 2007 Update in the XPath example gives this result:
nodeName[0]:Number nodeValue[0]:1 nodeName[1]:Number nodeValue[1]:225 nodeName[2]:Number nodeValue[2]:236
The ideas in this example should help you work with Delphi and 2007 using either the MSXML 6 DOM or the OpenXML DOM (Delphi XE2 supports MSXML 6 DOM or ADOM XML v4 DOM).
Please note that the behavior of MSXML 6 is highly dependent on the version you have installed, which depends on your Windows OS (hence this answer ).
Which probably means that you have not installed the latest MS XML 6 or the correct libraries have not been imported from it (the msxml block of Delphi 2007 does not contain IXMLDOMDocument2 , which you need to support XPath).
On July 27, 2012, I made some time to retro-fit the Delphi 2007 example and test it.
Iβm not quite sure that this is a complete memory leak (I hacked into the TDictionary class for inputting interfaces), but the results are the same as the Delphi XE2 example, and at first glance it looks quite normal.
In the XPathTester
demo application XPathTester
download Example 3, then run XPath (which will load your example and run XPath).
Note that most of the other things in the bo library require at least Delphi 2009, but this part works.
In the following weeks I will test it, as I require it in another project that is still in Delphi 2007.
procedure TMainForm.LoadXmlExample3ButtonClick(Sender: TObject); begin LoadXmlExample([ // unique account numbers '/Accounts/Account[not(@Number=preceding-sibling::Account/@Number)]/@Number' ], [ '<?xml version="1.0"?>', '<Accounts>', ' <Account Number="1" DebitAmount="1000" Amount="2827561.95" />', ' <Account Number="225" DebitAmount="2000" Amount="12312.00" />', ' <Account Number="236" DebitAmount="London" Amount="457656.00" />', ' <Account Number="225" DebitAmount="London" Amount="23462.40" />', ' <Account Number="236" DebitAmount="Bangalore" Amount="2345345.00" />', '</Accounts>' ]); end;