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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T17:15:56+00:00 2026-05-21T17:15:56+00:00

Question 1: Assume that i am reading XmlNodeType.Text and I would like to know

  • 0

Question 1: Assume that i am reading XmlNodeType.Text and I would like to know its tag node name. How do you do that without moving cursor up or down? Also How can I know parent tag of current node tag?

Question 2: Assume that I am reading xml file and I would like to start at particular node tag. How can do that?

Question 3: if you have xsd file, is there easy way to upload xml file? I am using C# 3.5 .net and sql server 2008.

This is what i wrote so far:

XmlTextReader reader = new XmlTextReader("datafile.xml");
while (reader.Read())
{
    if (reader.NodeType == XmlNodeType.Element)
    {
        Console.Write(reader.Name);
    }
    else if (reader.NodeType == XmlNodeType.Text)
    {
        Console.Write("/"+reader.Name+"/" + reader.Value+"/");
    }
    else
    {
        if (reader.NodeType == XmlNodeType.EndElement)
        {
            Console.WriteLine(reader.Name);
            Console.ReadLine();
        }
    }
}
reader.Close();

Please let me know if you need more clarification

  • 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-21T17:15:57+00:00Added an answer on May 21, 2026 at 5:15 pm

    XmlReader is stateless and only retains information about the current node, so if you are reading the content of an element and wish to know the elements name you need to make sure that when you read the start element node you somehow retain the element name.

    Again if you want to know the name of the parent element you need to retain this information / state yourself as you read through the xml document.

    If you wish to start reading at a particular node you should go through and read the xml document node by node until you read the node you wish to start at.

    Ultimately reading xml via the XmlReader class is more difficult than the alternatives, generally speaking you would only use XmlReader if the the xml document is very large, in most other cases using one of the alternatives:

    • Linq to XML
    • The XmlDocument class
    • Using XSD.exe to generate a .Net class from a XSD file that can be used to serialise and deserialise xml via the XmlSerializer class.

    For more information see XML Serialization in the .NET Framework

    If you really want to use XmlReader then you should read Using the XmlReader Class .

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

Sidebar

Related Questions

For this question, let us assume that we will want to show the face
I have a question regarding static function in php. let's assume that I have
This is a question about generic c++ event driven applications design. Lets assume that
(For the purposes of this question, let us assume that one is intentionally not
The question: Assume that cache memory is ten times faster than DRAM memory, that
The following question is more complex than it may first seem. Assume that I've
Assume that I have some HTML page, and a corresponding CSS file. I'd like
After posting this question and reading that one I realized that it is very
Extreme edit to question to have it make more sense: Let's assume that I
This question assumes there's a blessed central repository that members of a team clone

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.