Solved

Processing XML Files

Posted on 2004-10-01
2
198 Views
Last Modified: 2010-04-15
I am developing a C# application that monitors a directory on a server for XML files.  These XML files are written to this directory through a separate application.  What my application needs to do is grab the XML file, parse it, insert the data into a database, and remove the file to separate location.  I am using the file system watcher class for listening to the files.  My question is what is the best way to read these XML files?  Should I read them into a dataset or is there another efficient way of doing it?   I am a novice .NET developer so any help will be appreciated.

Thanks
0
Comment
Question by:fifo123
2 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 12202040
Is the XML file structure simple?  Are they small, medium or large files?  If so, then using the DataSet.ReadXML is a very straight forward approach.

Bob
0
 
LVL 10

Accepted Solution

by:
ptmcomp earned 50 total points
ID: 12215480
Well, it depends how they should be stored in the database. If they are stored as text then it would be enough to just load them as text. Validating them whould be good to avoid garbage being written to the database... That can be done using an XmlValidatingReader and listening to the events.
XmlDocument would be easier and straight forward but it has more overhead. If there are few small files this is not relevant but if they are big you the way described before might be better...
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question