mori0043 Posted August 21, 2003 Posted August 21, 2003 Hi, I use an ini file for configurations such as database connect values and GUI label text values. I wanted to use an XML file instead. For example: <GUI Text> <Language name="English"> <Form name="LogonForm"> <Title>?</Title> <UID_lbl>?</UID_lbl> <PWD_lbl>?<PWD_lbl> <OK_Button>?</OK_Button> <Cancel_Button>?</Cancel_Button> </Form> <Form name="MainScreen"> <Title></Title> <Checkbox1>?</Checkbox1> <Checkbox2>?</Checkbox2> <Checkbox3>?</Checkbox3> <Checkbox4>?</Checkbox4> <OK_Button>?</OK_Button> </Form> </Language> </GUI Text> I have code to read an ini file in VB.Net, but are there any classes or code out there to read the xml file above? Thanks in advance. Quote
*Experts* mutant Posted August 21, 2003 *Experts* Posted August 21, 2003 Yeah, they are all located in System.XML namespace. The class you will probably use is XMLTextReader. Here are some good tutorials to get you started: http://samples.gotdotnet.com/quickstart/howto/default.aspx?url=/quickstart/howto/doc/Xml/OverviewofXML.aspx :) Quote
mori0043 Posted August 24, 2003 Author Posted August 24, 2003 Thanks. From here I created a parser and it seems to work. My only question now is, what is the advantage to using XML? I find that the coding is much harder to parse through and I really can't see why people wouldn't just use an ini file instead. Is there any answer to this? Thanks. Quote
mori0043 Posted August 24, 2003 Author Posted August 24, 2003 TO rephrase my question... I don't see an easy way to grab text from an XML file for a form's labels based on language. I have done it with an ini file with ease, but it seems much harder from XML. I have heard that XML is a better way and I don't understand what the advantage is. Quote
*Experts* Nerseus Posted August 24, 2003 *Experts* Posted August 24, 2003 I'd go with the XmlDocument class and use it's Load method to read an XML file from disk. Look at this post for a code snippet. There are a couple of posts on this forum that discuss INI files vs. XML. There are many advantages to using XML, but ease of use in the beginning isn't one of them. Once you pick up XML it's easy enough though. -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.