Advertisement

07.27.2005 at 10:11AM PDT, ID: 21506449
[x]
Attachment Details

XmlTextReader: Parsing an XML file in C# (ASP.NET)

Asked by mitztraykray in C# Programming Language

Tags:

I am trying to learn how to work with XML better... please help me figure out how to do this example.  There are certain elements that have child elements - I don't want to display them or the child elements, because I will loop through them later.  Please help!


while(xmlReader.Read)
{
  if(xmlReader.NodeType == XmlNodeType.Element)
    {
      if(xmlReader.LocalName == "USER")
       {
         // Don't read ANY of this element, or child elements!
       }
    }
}


XML Example:

<Root>
 <company>
   <owner>John Doe</owner>
    <user>
       <name>mgreen</name>
       <birthdate>09/19/1980</birthdate>
    </user>

    <user>
      <name>aasdf</name>
      <birthdate>09/19/2004</birthdate>
     </user>

   <manager>MyName</Manager>
 </company>
</Root>

this isn't a real xml file, but I am trying to find out how to develop this so when I do have a real file, i know what to do.  I appreciate any help you can give me.

BrStart Free Trial
 
Loading Advertisement...
 
[+][-]07.27.2005 at 11:20AM PDT, ID: 14539639

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: C# Programming Language
Tags: xmltextreader
Sign Up Now!
Solution Provided By: rnagli
Participating Experts: 2
Solution Grade: A
 
 
[+][-]07.27.2005 at 09:22PM PDT, ID: 14543108

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32