Results 1 to 3 of 3

Thread: xml help[RESOLVED]

Threaded View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    xml help[RESOLVED]

    been trying and going insane

    I have written an xml doc like he following:

    <Main>
    <Something1>valueHere</Something1>
    <Something2>valueHere</Something2>
    </Main>


    but how do I read the first element (Something1) and then the text inbetween? (valueHere)

    this is what I have:

    Code:
    XmlTextReader tr = new XmlTextReader(path);
    while(tr.Read())
    {
       if (tr.NodeType == XmlNodeType.Text)
       {
          tr.ReadString();
          if (tr.Name.Equals("Something1"))
          {
              //value/name
          }
    ..
    ..
       }
    }
    but it only gets the Name (Somethingx) but not the inner value.

    any ideas?
    Last edited by Techno; Sep 4th, 2005 at 10:37 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width