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 8077473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:29:09+00:00 2026-06-05T15:29:09+00:00

I want to get to the exact node having this text: ‘Company’. Once I

  • 0

I want to get to the exact node having this text: ‘Company’. Once I get to this node I want to get to the next text node immediately following this node because this contains the company name. How can I do this with Xpath?

Fragment of XML is:

<div id="jobsummary">
    <div id="jobsummary_content">
        <h2>Job Summary</h2>
        <dl>
            <dt>Company</dt>
            <!-- the following element is the one I'm looking for -->
            <dd><span class="wrappable">Pinpoint IT Services, LLC</span></dd>
            <dt>Location</dt>
            <dd><span class="wrappable">Newport News, VA</span></dd>
            <dt>Industries</dt>
            <dd><span class="wrappable">All</span></dd>
            <dt>Job Type</dt>
            <dd class="multipledd"><span class="wrappable">Full Time</span></dd><dd class="multipleddlast"><span class="wrappable"> Employee</span></dd>
        </dl>
    </div>
</div>

I got to the Company tag with following xpath: //*[text()= 'Company']
Now I want to get to the next text node. My XML is dynamic. So I can’t hardcode the node type like <dd> for getting the company value. But this is for sure that the value be in the immediate next text node.

So how can I get to the text node immediately after the node with text as Company?

  • 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-06-05T15:29:11+00:00Added an answer on June 5, 2026 at 3:29 pm

    If you cannot hardcode any part of the following-sibling node your xpath should look like this:

    //*[text()='Company']/following::*/*/text()
    

    assuming that the desired text is always enclosed in another element like span.


    To test for given dt text, modify your xpath to

    //*[text()='Company' or text()='Company:' or text()='Company Name']/following::*/*/text()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I don't get the exact method to do this. I want a method not
I want to get the exact row from the following data id name groupid
I want get the exact age of the following date in var $birth_date by
I want to get exact height of the body of webbrowser window. I tried
Query Select 9/5 'Showing output as 1 I want to get the exact ouput
I want to get the exact X and Y position where I longClicked in
I want to make a simple application having only one text field and a
I have multiple PHP strings (10-100k characters each) and want to get exact elements
I want to get the exact position of the X, Y, Z position that
Pretty simple but I cant get the exact syntax working. I just want a

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.