Working with XML

Discussion in 'ASP .Net' started by David Lozzi, Sep 27, 2007.

  1. David Lozzi

    David Lozzi Guest

    Howdy,

    I'm using VB.Net 2.0. Is there an easy object to use to handle XML?
    Basically, i am collecting a ton of info from SQL, from various
    Tables/Views/Procs, adding some data on the fly then I need to output the
    entire thing to XML. I know i can create a string object and simply create
    an XML string but that's messy. I know there's a XMLDocument object but I
    can't seem to get it to work. Ideally, i'd like to have an XML object of
    some sort and then work through it's elements/nodes and populate the
    information as needed. If you could provide some sample script that'd be
    great.

    Thanks!
    David Lozzi
     
    David Lozzi, Sep 27, 2007
    #1
    1. Advertising

  2. David Lozzi

    sloan Guest

    To write xml, look at the XmlWriter

    http://www.c-sharpcorner.com/Upload...r11132005233450PM/writexmlusingXmlWriter.aspx

    or google it.

    I think it is your "lightest weight" object for writing needs.

    If you have an EXISTING xml doc, then you need to use the XmlDocument,
    because you'll have to use something like

    SelectNodes
    SelectSingleNode

    to navigate the tree, and find the correct place to insert/update data.



    "David Lozzi" <> wrote in message
    news:...
    > Howdy,
    >
    > I'm using VB.Net 2.0. Is there an easy object to use to handle XML?
    > Basically, i am collecting a ton of info from SQL, from various
    > Tables/Views/Procs, adding some data on the fly then I need to output the
    > entire thing to XML. I know i can create a string object and simply create
    > an XML string but that's messy. I know there's a XMLDocument object but I
    > can't seem to get it to work. Ideally, i'd like to have an XML object of
    > some sort and then work through it's elements/nodes and populate the
    > information as needed. If you could provide some sample script that'd be
    > great.
    >
    > Thanks!
    > David Lozzi
     
    sloan, Sep 27, 2007
    #2
    1. Advertising

  3. David Lozzi

    IfThenElse Guest

    If you manipulated data can end in a DataSet then

    Dim YourDataSetThatHasAllTheMinipulatedData as
    System.Data.DataSet

    YourDataSetThatHasAllTheMinipulatedData.WriteXml("XMLFile.xml")

    This might help you?


    "David Lozzi" <> wrote in message
    news:...
    > Howdy,
    >
    > I'm using VB.Net 2.0. Is there an easy object to use to handle XML?
    > Basically, i am collecting a ton of info from SQL, from various
    > Tables/Views/Procs, adding some data on the fly then I need to output the
    > entire thing to XML. I know i can create a string object and simply create
    > an XML string but that's messy. I know there's a XMLDocument object but I
    > can't seem to get it to work. Ideally, i'd like to have an XML object of
    > some sort and then work through it's elements/nodes and populate the
    > information as needed. If you could provide some sample script that'd be
    > great.
    >
    > Thanks!
    > David Lozzi
     
    IfThenElse, Sep 27, 2007
    #3
  4. David Lozzi

    IfThenElse Guest

    http://www.aspnettutorials.com/tutorials/database/XML-vb.aspx

    "David Lozzi" <> wrote in message
    news:...
    > Howdy,
    >
    > I'm using VB.Net 2.0. Is there an easy object to use to handle XML?
    > Basically, i am collecting a ton of info from SQL, from various
    > Tables/Views/Procs, adding some data on the fly then I need to output the
    > entire thing to XML. I know i can create a string object and simply create
    > an XML string but that's messy. I know there's a XMLDocument object but I
    > can't seem to get it to work. Ideally, i'd like to have an XML object of
    > some sort and then work through it's elements/nodes and populate the
    > information as needed. If you could provide some sample script that'd be
    > great.
    >
    > Thanks!
    > David Lozzi
     
    IfThenElse, Sep 27, 2007
    #4
  5. On Sep 27, 9:01 pm, "David Lozzi" <> wrote:
    > Howdy,
    >
    > I'm using VB.Net 2.0. Is there an easy object to use to handle XML?
    > Basically, i am collecting a ton of info from SQL, from various
    > Tables/Views/Procs, adding some data on the fly then I need to output the
    > entire thing to XML. I know i can create a string object and simply create
    > an XML string but that's messy. I know there's a XMLDocument object but I
    > can't seem to get it to work. Ideally, i'd like to have an XML object of
    > some sort and then work through it's elements/nodes and populate the
    > information as needed. If you could provide some sample script that'd be
    > great.
    >
    > Thanks!
    > David Lozzi


    e.g. XmlTextWriter

    StringWriter sw = new StringWriter();
    XmlTextWriter writer = new XmlTextWriter(sw);
    writer.WriteStartElement("...");
    writer.WriteEndElement();
    writer.Flush();
    writer.Close();
    sw.Close();
     
    Alexey Smirnov, Sep 27, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bomb Diggy
    Replies:
    0
    Views:
    447
    Bomb Diggy
    Jul 28, 2004
  2. Tony Prichard
    Replies:
    0
    Views:
    733
    Tony Prichard
    Dec 12, 2003
  3. Kee Nethery
    Replies:
    12
    Views:
    2,091
    Stefan Behnel
    Jun 27, 2009
  4. Erik Wasser
    Replies:
    5
    Views:
    463
    Peter J. Holzer
    Mar 5, 2006
  5. noff
    Replies:
    0
    Views:
    208
Loading...

Share This Page