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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:24:11+00:00 2026-05-23T09:24:11+00:00

I use CSharp, XPath and HTMLAgility Pack. I use XPath strings such as: //table[3]/td[1]/span[2]/text()

  • 0

I use CSharp, XPath and HTMLAgility Pack. I use XPath strings such as:

"//table[3]/td[1]/span[2]/text() | //table[6]/td[1]/span[2]/text()"
"//table[8]/td[1]/span[2]/text() | //table[10]/td[1]/span[2]/text()"

The difference is only in table numbers. Is it possible to use some other XPath function to replace the XPath or |?

What I actually do: With the first XPath string (where I have table numbers 3 & 6) I extract one value. With the second XPath string (where i have table numbers are 8 & 10) I extract another value.

And additional question about performance – is the XPath string //table[8]/td[1]/span[2]/text() faster than the XPath string with OR //table[8]/td[1]/span[2]/text() | //table[10]/td[1]/span[2]/text()? I ask this because I have many many XPath strings for many many values and if there is a difference which really means I need to try something else. I can’t do the measurement right now that’s why I ask you this question to share your experience.

  • 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-23T09:24:11+00:00Added an answer on May 23, 2026 at 9:24 am

    Firstly, //table[6] looks odd. Are you sure you don’t mean (//table)[6]? (The first selects every table that is the 6th child of its parent; the second selects the sixth table in the document.) I will assume the latter.

    In XPath 2.0 you can write

    (//table)[position()=(3,6,8,10)]/td[1]/span[2]/text()
    

    In 1.0 that would have to be

    (//table)[position()=3 or position()=6 or position()=8 or position()=10]
        /td[1]/span[2]/text()
    

    Or (in either release) you could write

    ((//table)[3] | (//table)[6] | (//table)[8] | (//table)[10])/td[1]/span[2]/text()
    

    Your question about performance can’t be answered without knowing what XPath implementation you are using.

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

Sidebar

Related Questions

use Text::Table; my $tb = Text::Table->new(Planet,Radius\nkm,Density\ng/cm^3); $tb->load( [ Mercury,2360,3.7], [ Mercury,2360,3.7], [ Mercury,2360,3.7], );
it only works when I use the same port(9050 or some other) in both
Im tried to use NAudio demo app for MP3 Streaming in Csharp, when i
I'm trying to use the MiscUtil.Conversion utility in Silverlight. http://www.yoda.arachsys.com/csharp/miscutil/ When I try to
I'm trying to do some integration test in a csharp project, I'm using Entity
I have a ip check in my source use csharp. And now, I must
I use a WebBrowser object from WPF and I'm calling some Javascript code in
I trying to use apns-csharp library to send push notification from .NET, I created
I happen to know mono's CSharpRepl , are there emacs csharp mode that use
I am learnig CSharp.I have some doubts in handling exceptions.Kindly guide me to improve

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.