XML Help wanted

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • edamron

    #1

    XML Help wanted

    I'm new to vb.net and have never used xml. However, xml looks pretty
    straight forward and I would like to learn how use it to create a
    configuration file for a small app.

    I got the xmlTextWriter to write out a file and I thought "Oh! this
    must be the way!" But now I'm backing off from it because even though
    it wrote a file I'm not sure that the file is correct xml and there are
    many classes that seem to work with xml files and I may not be using
    the best choice.

    So I would like to ask which class would be the best to use to create
    what I want? Also a small code snippet showing me how to use the
    class(es) would help.

    Let's say I have two configuration elements I want to store and
    retrieve:

    DirectoryPath and DatabaseName

    And the values were "C:\mypath" and "myDatabase "

    Thanks in advance.

  • Cor Ligthert [MVP]

    #2
    Re: XML Help wanted

    deamron,

    As there is one thing not straight foreward than it is XML, the
    documentation that describes it seems to be more than a meter high. It is a
    way to transport data where the description of that is given.

    An easy way to use it is as the dataset.
    Simple made typed here.

    dim ds as new dataset
    dim dt as new datatable
    ds.add(dt)
    dt.columns.add( "myItem1")
    dt.columns.add( "myItem2")
    dt.loaddatarow( new Object() {"deamron", "cor"}, true)

    To write it
    ds.writexml(myp ath)
    To read it than again
    ds.readxml(mypa th)

    There are more methods to add a row by the way.

    I hpe this helps,

    Cor

    "edamron" <edamron@spamco p.net> schreef in bericht
    news:1141854612 .270147.87730@p 10g2000cwp.goog legroups.com...[color=blue]
    > I'm new to vb.net and have never used xml. However, xml looks pretty
    > straight forward and I would like to learn how use it to create a
    > configuration file for a small app.
    >
    > I got the xmlTextWriter to write out a file and I thought "Oh! this
    > must be the way!" But now I'm backing off from it because even though
    > it wrote a file I'm not sure that the file is correct xml and there are
    > many classes that seem to work with xml files and I may not be using
    > the best choice.
    >
    > So I would like to ask which class would be the best to use to create
    > what I want? Also a small code snippet showing me how to use the
    > class(es) would help.
    >
    > Let's say I have two configuration elements I want to store and
    > retrieve:
    >
    > DirectoryPath and DatabaseName
    >
    > And the values were "C:\mypath" and "myDatabase "
    >
    > Thanks in advance.
    >[/color]


    Comment

    Working...