Link to home
Create AccountLog in
Avatar of mathieu_cupryk
mathieu_cuprykFlag for Canada

asked on

XML file to C#.

I have to parse an xml file, do I need the xsd file that is associated to read the elements into a database table.

Any help would be great.
Avatar of 0xC0DEB07

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of mathieu_cupryk


Cool bro.


So the xsd file is used for validating the XML file. Anything else I should know?

I appreciate any feedback.
Avatar of cjard

Reading the Xml is trivial..

DataSet ds = new DataSet();
FileInfo fi = new FileInfo("c:\myxmlfile.xml");

er. That's it. If your XML is broken, i'm sure youll get an exception.. otherwise youll get a dataset you can investigate in the debugger. I wrote a simple form to investigate mine: one list box and one datagridview.. the names of the tables go in the listbox, then when the lsitindex is changed, the table is assigned to the datasource of the datagridview.

I'd have pasted the cource but it's in VB.NET. Can you read VB.NET?
Yea sure, I would love that you can send it to me:
mathieu_cupryk at

I appreciate it.

Do you have any that takes an xml file and uses the xsd and stores the elements.