Read xml data

Last post 07-04-2008 5:04 AM by Samu Zhang - MSFT. 1 replies.

Sort Posts:

  • Read xml data

    06-30-2008, 1:51 PM
    • Loading...
    • Frozzare
    • Joined on 08-23-2007, 7:28 PM
    • Sweden
    • Posts 46

     Hi.

     i try to read the data in my .xml file.

     

       protected void Page_Load(object sender, EventArgs e)
    {

    XmlDocument doc = new XmlDocument();
    doc.LoadXml("<settings>" +
    <imagessize>" +
    </imagessize>" +
    <frontpage></frontpage>" +
    </settings>");

    XmlTextReader reader = new XmlTextReader(Server.MapPath("App_Data\\Settings.xml"));
    reader.MoveToContent();


    XmlNode Settings = doc.ReadNode(reader);




    doc.DocumentElement.AppendChild(Settings);

    string StrFront = Convert.ToString((Settings));

    TextBox1.Text = StrFront;
    }
     
    But i don't get any longer, how to write out the data in the xml file? 
      
  • Re: Read xml data

    07-04-2008, 5:04 AM
    Answer

    Hi Frozzare ,

    First of all ,I want to say there is one sample which almost the same with your code : http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.readnode.aspx

    And I notice that :

    Frozzare:
    string StrFront = Convert.ToString((Settings));

    The code can get the name of Class instead of it's innerText . You can try to use Settings.OuterXml.

     

    Sincerely,
    Samu Zhang
    Microsoft Online Community Support

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
Page 1 of 1 (2 items)
Microsoft Communities
Page view counter