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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:16:23+00:00 2026-05-23T12:16:23+00:00

The XML file structure is like this. <?xml version=1.0 encoding=UTF-8?> <Application> <Tabs> <Tab name=1>

  • 0

The XML file structure is like this.

<?xml version="1.0" encoding="UTF-8"?>
    <Application>
          <Tabs>
             <Tab name="1">
               <title>abcd</title>
               <description>xyz</description>
             </Tab>
             <Tab name="2">
               <title>abcde</title>
               <description>xyzw</description>
             </Tab>
          </Tabs>
         <Files>
         </Files>
    </Application>

I would like to read only the Tabs section using XmlReader in asp.net 2.0. The values that I’m interested in are the title and description contents. There are in total 7 tabs which can increase also later on. Hence can’t iterate over a count variable with value fixed.

  • 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-23T12:16:24+00:00Added an answer on May 23, 2026 at 12:16 pm

    If you can use XPathDocument, you can try something like this.

    Note: If you already have a XmlReader instance, instead of using StringReader, you can use the constructor overload that take XmlReader.

    string xml = @"<?xml version=""1.0"" encoding=""UTF-8""?>
    <Application>
          <Tabs>
             <Tab name=""1"">
               <title>abcd</title>
               <description>xyz</description>
             </Tab>
             <Tab name=""2"">
               <title>abcd</title>
               <description>xyzw</description>
             </Tab>
          </Tabs>
         <Files>
         </Files>
    </Application>";
    
    string xpath = "/Application/Tabs/Tab/description";
    
    XPathDocument doc = new XPathDocument(new StringReader(xml));
    XPathNavigator nav = doc.CreateNavigator();
    XPathNodeIterator nodeIterator = nav.Select(xpath);
    
    foreach (XPathNavigator item in nodeIterator)
    {
        Console.WriteLine(item.Value);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm reading an XML file that looks like this: <?xml version=1.0 encoding=utf-8?> <VehicleList> <Vehicle>
I have an XML file that looks like this: <?xml version=1.0? encoding=UTF-8 standalone=no?> <dir
I have an XML file with this structure: <?xml version=1.0 encoding=utf-8 ?> <Photobank> <Landowner
This is my app.config file looks like: <?xml version=1.0 encoding=utf-8 ?> <configuration> <appSettings> <add
I have a plist structured like this: <?xml version=1.0 encoding=UTF-8?> <!DOCTYPE plist PUBLIC -//Apple//DTD
I would like copy just file.xml without folder structure using overlays like this: <overlays>
I have the following XML file: <xml version=1.0 encoding=utf-8?> <Data> <Parameter1>1</Parameter1> </Data> I want
I have XML file (output of some application) like this: <data> <call function=get_user_data> <output>
I have an xml file that contains in products. File's structure this: <?xml version=1.0
I have an XML file with this structure: <?xml version=1.0> <person> <element att1=value1 att2=value2>Anonymous</element>

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.