Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4079252
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:46:40+00:00 2026-05-20T17:46:40+00:00

In Delphi XE is it possible to use XPath with a TXmlDocument component? I’m

  • 0

In Delphi XE is it possible to use XPath with a TXmlDocument component?

I’m aware I can use late binding to access the MSXML2 and then use XPath:

XML := CreateOleObject('MSXML2.DOMDocument.3.0') ;
XML.async := false;
XML.SetProperty('SelectionLanguage','XPath');

But I wanna know if TXmlDocument installed with Delphi XE supports XPath.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T17:46:41+00:00Added an answer on May 20, 2026 at 5:46 pm

    I can’t find anything in the TXMLDocument documentation about XPath.

    XML example, from the OmniXML XPath demo:

    <?xml version="1.0" encoding="UTF-8"?>
    <bookstore>
      <book>
        <title lang="eng">Harry Potter</title>
      </book>
      <book>
        <title lang="eng">Learning XML</title>
      </book>
      <book>
        <title lang="slo">Z OmniXML v lepso prihodnost</title>
        <year>2006</year>
      </book>
      <book>
        <title>Kwe sona standwa sam</title>
      </book>
    </bookstore>
    

    Try something like this:

    uses 
      XMLDoc, XMLDom, XMLIntf;
    
    // From a post in Embarcadero's Delphi XML forum.
    function selectNode(xnRoot: IXmlNode; const nodePath: WideString): IXmlNode;
    var
      intfSelect : IDomNodeSelect;
      dnResult : IDomNode;
      intfDocAccess : IXmlDocumentAccess;
      doc: TXmlDocument;
    begin
      Result := nil;
      if not Assigned(xnRoot) or not Supports(xnRoot.DOMNode, IDomNodeSelect, intfSelect) then
        Exit;
      dnResult := intfSelect.selectNode(nodePath);
      if Assigned(dnResult) then
      begin
        if Supports(xnRoot.OwnerDocument, IXmlDocumentAccess, intfDocAccess) then
          doc := intfDocAccess.DocumentObject
        else
          doc := nil;
        Result := TXmlNode.Create(dnResult, nil, doc);
      end;
    end;
    
    
    var
      IDoc: IXMLDocument;
      INode: IXMLNode;
    begin
      IDoc := LoadXMLDocument('.\books.xml');
      INode := SelectNode(IDoc.DocumentElement,'/bookstore/book[2]/title'); 
    end;
    

    Just as an FYI for others, I’ll leave this in: OmniXML supports XPath, and has a demo that shows really well how to use it. It’s also free, comes with source, supports Unicode, and has pretty good support through it’s forums.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: How can I use Delphi to test if a Directory is writeable?
Is it possible to use LINQ in win32 DELPHI applications
Is it possible to use a .NET DLL in Delphi 2007 for Win32? I've
Is it possible to use de Delphi 7 compiler inside Delphi 2010 IDE? We
Is possible to use ADO .Net from an Win32 Application build with Delphi 7.
Is it possible to use a font directly from resources in Delphi and how?
Is it possible to use interface method as event handlers in Delphi 2007? The
Is it somehow possible to use the Delphi language (or Prism if absolutely necessary)
Can I use Delphi to program to the Java Native Interface ? From reading
Possible Duplicates: Downloading a file in Delphi Delphi File Downloader Component Hello everyone, I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.