Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

Posted

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.

Posted
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.
  • *Experts*
Posted

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

"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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...