VB.NET read xml file as ini

mori0043

Member
Joined
Jul 26, 2003
Messages
7
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.
 
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 cant see why people wouldnt just use an ini file instead. Is there any answer to this?

Thanks.
 
TO rephrase my question... I dont see an easy way to grab text from an XML file for a forms 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 dont understand what the advantage is.
 
Id go with the XmlDocument class and use its 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 isnt one of them. Once you pick up XML its easy enough though.

-Nerseus
 
Back
Top