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

  • SEARCH
  • Home
  • 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 6682319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:41:32+00:00 2026-05-26T04:41:32+00:00

I want to select parent or sibling of a node using HTML::TreeBuilder::XPath Perl module,

  • 0

I want to select parent or sibling of a node using HTML::TreeBuilder::XPath Perl module, Lets take a sample HTML as follows:

<tbody>
    <tr>
        <td class="c1">Match_Text</td>
        <td class="c2">Extact_Text</td>
    </tr>
    <tr>
        <td class="c1"></td>
        <td class="c2"></td>
    </tr>
</tbody>

So I want to extract text “Match_Text” for this I give xpath expression as:

'/html/body//td[@class="c1"]="Match_Text"/../td[@class="c2"]'

which is a valid expression for my use case.

But looks like going to parent not implement and I get following error from perl module:

axis axis_parent not implemented [Can’t locate object method
“getParentNode” via package “XML::XPathEngine::Literal” at
/usr/local/share/perl/5.10.1/XML/XPathEngine/Step.pm line 326. ]

Can anyone suggest an alternate Xpath expression that may work for my use case (accessing parent/sibling of a node). Note that I want to do this only using Xpath expression and dont want to create a DOM and explicitly traverse the tree.

  • 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-26T04:41:32+00:00Added an answer on May 26, 2026 at 4:41 am

    The error message is misleading. The problem isn’t lack of support, it’s that you’re trying to find the parent of the boolean returned by the comparison. It doesn’t have one.

    You could use

    //*[ td[@class="c1" and text()="Match_Text"] ]/td[@class="c2"]
    
    //td[@class="c1" and text()="Match_Text"]/following-sibling::*
    
    //td[@class="c1" and text()="Match_Text"]/following-sibling::td[@class="c2"]
    
    //td[@class="c1" and text()="Match_Text"]/../td[@class="c2"]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to select xml node with conditional Xpath like- xmlnode.SelectSingleNode(if (ns:substanceAdministration/ns:consumable/@typeCode == UNK)
I have a categories structure as follows I want to select leaf node. i
$country.parent().parent().next().children('td').children('.province-select') Basically I have some HTML that looks like this: <table> <tr> <th>country</th> <td><select
I want to select and toggle() the child of the parent of the parent
I'm using jQuery's dynaTree in my application and I want to select the all
Greetings, By using the regular selector, I am able to select the grand parent
I have a table structure as follows and I want to select all active
SELECT parent.name FROM categories AS node, categories AS parent, categories AS parent1 WHERE node.left_node
i have users table and i have posts table i want select from users
I want to select the topmost element in a document that has a given

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.