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.
ASKER CERTIFIED SOLUTION
Avatar of 0xC0DEB07
0xC0DEB07

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

ASKER

Cool bro.

OxCODEV07

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

I appreciate any feedback.
Avatar of cjard
cjard

Reading the Xml is trivial..

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



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 yahoo.com

I appreciate it.
Hi CJARD

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