Avatar of mathieu_cupryk
mathieu_cupryk
Flag 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.
C#

Avatar of undefined
Last Comment
mathieu_cupryk

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
0xC0DEB07

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
mathieu_cupryk

ASKER
Cool bro.

mathieu_cupryk

ASKER
OxCODEV07

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

I appreciate any feedback.
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?
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
mathieu_cupryk

ASKER
Yea sure, I would love that you can send it to me:
mathieu_cupryk at yahoo.com

I appreciate it.
mathieu_cupryk

ASKER
Hi CJARD

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