Solved

Processing XML Files

Posted on 2004-10-01
2
194 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
Comment Utility
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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Problem to event 3 48
Problem to open Excel file 15 37
Achieve json result 2 24
XML & .net 5 14
Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now