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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:28:11+00:00 2026-06-12T11:28:11+00:00

Below is xml file format from which words to be searched. <Book> <Page id=1>

  • 0

Below is xml file format from which words to be searched.

<Book>
<Page id="1">
<Head>Preface</Head>
<Body>
<Paragraph>
    <Line>
        <Word>
            <Char>T</Char>
            <Char>h</Char>
            <Char>i</Char>
            <Char>s</Char>
        </Word>
        <Word>
            <Char>-</Char>
        </Word>
        <Word>
            <Char>i</Char>
            <Char>s</Char>
        </Word>
        <Word>
            <Char>-</Char>
        </Word>
        <Word>
            <Char>s</Char>
            <Char>a</Char>
            <Char>m</Char>
            <Char>p</Char>
            <Char>l</Char>
            <Char>e</Char>
        </Word>
        <Word>
            <Char>-</Char>
        </Word>
        <Word>
            <Char>t</Char>
            <Char>e</Char>
            <Char>x</Char>
            <Char>t</Char>
        </Word>
    </Line>
</Paragraph>
</Body>
</Page>

I used the below XPath expressions in C# to find values of Char Node.

XmlDocument objXmlDoc = new XmlDocument();
XmlNodeList objXmlNodeList;
objXmlDoc.Load(sFilePath);
objXmlNodeList = objXmlDoc.SelectNodes("//CHAR[translate(text(),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')='" + txtFindText.Text.ToUpper() + "']");

Here, how to get a complete word with XPath from above XML File ?

  • 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-12T11:28:12+00:00Added an answer on June 12, 2026 at 11:28 am

    It is not possible theoretically. The reason is that XML/XPATH does not ensure order as the result of a query is a “node-set” which by definition is “an unordered collection of nodes without duplicates”.

    http://www.w3.org/TR/xpath/

    Nevertheless, you can get close to the requirement. For example, you can get the first word:

    XmlDocument objXmlDoc = new XmlDocument();
    XmlNodeList objXmlNodeList;
    objXmlDoc.Load(sFilePath);
    objXmlNodeList = objXmlDoc.SelectNodes("//Word");
    string s = string.Empty;
    XmlNodeList wordNodes = objXmlNodeList[0].ChildNodes;
    foreach (XmlNode characterNode in wordNodes)
    {
       s = s + characterNode.InnerText;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a XML file in csharp like the below format pls
I have an xml file likes below. <?xml version=1.0 encoding=utf-8 ?> <Book> <Title>Title</Title> <Content>Content</Content>
I have a sample xml file which looks like the one below: <Root> <SubOne>
I'm having an xml file in the below format: <Query> <map> <value name=val1>1</value> <value
I have unusual format of XML as below example <mainmenu> <menu caption=File> <menuitem caption=New
From a XML file I receive decimals on the format: 1.132000 6.000000 Currently I
I have an xml file in below format and I decided to use libxml2
I am trying to scrape an xml file with the below format file_sample.xml: <rss
How to read the below xml file and write its content into a plain
How do I change my XML file below to have CAS return to the

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.