Results 1 to 8 of 8

Thread: Simple way of using XML as Config File? (VB6)

  1. #1

    Thread Starter
    Addicted Member señorbadger's Avatar
    Join Date
    Oct 2003
    Location
    Mud pools of wellingborough
    Posts
    193

    Question Simple way of using XML as Config File? (VB6)

    Hi i was just wondering if there is a simple way to use xml as a application configuration file in VB6.

    Can someone show me how to put a xml file into varibles i mean like

    timeout would be equal to the value of <Timeout> in the xml i am using below is my xml

    Code:
    <?xml version="1.0" encoding="iso-8859-1"?>
    <CONFIG>
        <Network>
            <IP>80</IP>
            <HOST>127.0.0.1</HOST>
            <Timeout>12</Timeout>
        </Network>
        <General>
            <Auto>1</Auto>
            <ONTOP>True</ONTOP>
        </General>
    </CONFIG>
    and my vb code so far i am using XML 2.6
    VB Code:
    1. Dim xml As MSXML2.XMLDocument
    2. Set xml = New MSXML2.XMLDocument
    3. xml.url = App.Path & "\config.xml"
    Last edited by señorbadger; Dec 4th, 2003 at 03:09 AM.

  2. #2
    Frenzied Member Spajeoly's Avatar
    Join Date
    Mar 2003
    Location
    Utah
    Posts
    1,068
    Something wrong with .ini files?

  3. #3

    Thread Starter
    Addicted Member señorbadger's Avatar
    Join Date
    Oct 2003
    Location
    Mud pools of wellingborough
    Posts
    193
    you just nedd huge amounts of code for them and they a bit old now

  4. #4
    Frenzied Member Spajeoly's Avatar
    Join Date
    Mar 2003
    Location
    Utah
    Posts
    1,068
    Not really, just use a text file and call it an ini file.

    Parsing out xml is somehow going to be less code and faster?

  5. #5

    Thread Starter
    Addicted Member señorbadger's Avatar
    Join Date
    Oct 2003
    Location
    Mud pools of wellingborough
    Posts
    193
    ok so if i changed a setting how would i tell it to update

    ill forget the xml thing now just when i saw the code for a ini file i was shocked

  6. #6
    Frenzied Member Spajeoly's Avatar
    Join Date
    Mar 2003
    Location
    Utah
    Posts
    1,068
    You could just hold the settings in an Array, then write them to a file when you want to save them. If done properly, everything will hold the same indexes.

  7. #7

    Thread Starter
    Addicted Member señorbadger's Avatar
    Join Date
    Oct 2003
    Location
    Mud pools of wellingborough
    Posts
    193
    true true, thanks for ya help mate

  8. #8
    Frenzied Member Spajeoly's Avatar
    Join Date
    Mar 2003
    Location
    Utah
    Posts
    1,068
    Anytime. Mind you, it's all just suggestions. You naturally should always do things the way you want them done.

    Hell, MSN uses XML config files.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width