reading an XML file

Last post 05-10-2008 1:07 AM by LOVUDOTNET. 4 replies.

Sort Posts:

  • reading an XML file

    05-04-2008, 3:04 AM
    • Loading...
    • LOVUDOTNET
    • Joined on 05-02-2008, 5:51 AM
    • Posts 5

    Hi all,

    I'm developing an aspx page which contains lot of label controls on it. there are about 60 label controls which i have given witha caption. Eg lblName this captures name of the user. like that.There are some custermized labels.which means that client to client the label name get changed.Eg:lblDateJoined, one client wants it to be Date Joined and another client wants it to be Date Joined to the Group.

    I know that this can be done by using resource files but here to client to client we need to main tain the resource file.

    I want to know whether i can find a solution by using an XML file to this.

    Where user can cutermise the label caption in the xml file and whether the developer can write a code to extract what is in the xml file and populate it with the label.

     

    Please provide me with an answer

    thnks

     

     

     

  • Re: reading an XML file

    05-04-2008, 10:12 PM
    Answer

    You can use the XmlDocument to do that!

    Cheers
    Al
    My Blog
    Follow me
    Please click on 'Mark as Answer' if this post answered your question!
  • Re: reading an XML file

    05-06-2008, 7:41 AM
    • Loading...
    • LOVUDOTNET
    • Joined on 05-02-2008, 5:51 AM
    • Posts 5

     

    HI CAN U PLZ TEL ME HOW TO DO IT. ALSO I WANT TO KNOW ONCE THE WEBSITE IS DEPLOYED CAN A CLIENT TO CHANGE THE XML FILE EG. SAY THAT HE WANTS NAME TO APPEAR AS EMPLOYEE NAME . CAN HE CHANGE THIS IN THE XML FILE AND VIEW IT WITHOUT RECOMPILING IT.

    PLZ LET ME KNOW THE WAY TO DO UT

    THANKS

     

  • Re: reading an XML file

    05-06-2008, 10:24 PM
    Answer

    Hi LOVUDOTNET ,

    If you want to read an xml file. You can use XmlDocument to load it and use xpath to pick out one node .

     

    <root>
      <label>this is label</label>
    </root>
      
            XmlDocument doc = new XmlDocument();
            doc.Load(Server.MapPath("lab.xml"));
            XmlNode node = doc.SelectSingleNode("/root/label");
            this.Label1.Text = node.InnerText;

     

    If you want to edit xml file.

    See this useful link:

    http://www.codeproject.com/KB/aspnet/Edit_Xml.aspx

     

    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. This can be beneficial to other community members reading the thread.
  • Re: reading an XML file

    05-10-2008, 1:07 AM
    • Loading...
    • LOVUDOTNET
    • Joined on 05-02-2008, 5:51 AM
    • Posts 5

     

    Hi SAMU,

     Can u plz tel me this? If the user edits the content of the XML file do we need to recompile the project inorder to changes to get affected.

    Eg:/ as i explained in my problem if the user changes the value that is in the lab.xml do we need to build to get the changes?

    als i have another question, inorder to handle a such requirement as i mentioned in my problem wht is the best solution that Microsoft can provide me.

    MY PROBLEM:

    I'm developing an aspx page which contains lot of label controls on it. there are about 60 label controls which i have given witha caption. Eg lblName this captures name of the user. like that.There are some custermized labels.which means that client to client the label name get changed.Eg:lblDateJoined, one client wants it to be Date Joined and another client wants it to be Date Joined to the Group. I know that this can be done by using resource files but here to client to client we need to main tain the resource file.

    Cos if i make a table in the database and try to put the values that i want to populate in the form performance of the website might degrade.

    thats why i thought of moving to XML if it allows me to do so.

    but here the problem is i was asked  to provide an WEB interface to the user So that they can change the label caption as they want. So their decision is that i have to make a table in the database and store these values in the table.

     

    Can u plz provide me with an answer

     

    thanks

    LOVUDOTNET

     

Page 1 of 1 (5 items)