Results 1 to 3 of 3

Thread: [2.0] Reading xml file using C#

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2003
    Posts
    436

    [2.0] Reading xml file using C#

    I am tasked to read an xml file and save the contents to an oracle table.

    I am planning to load the xml doc into DOM and read the element by element. The file is not big at all. But I feel there should be some easier way than going thru each element tag to read the data. Is that a good practice or are there any new methods that I could use? I heard using XSD file, we can load the data into a datatable.

    thanks

    nath

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2.0] Reading xml file using C#

    If you're going to save the data to a database then the logical thing to do would be to read it straight into a DataSet. Create one and call its ReadXml method and you're done. You can then simply create your OracleCommand object with parameters that will draw data from the appropriate DataColumns and insert to the corresponding Oracle columns. All up it would be about 10 to 20 lines of code for your average table.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2003
    Posts
    436

    Re: [2.0] Reading xml file using C#

    Thanks Jm. I figured out.

    This forum used to be more active a year ago.

    nath

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