Solved

XML file to a usable data class in Visual Studios.

Posted on 2013-06-12
3
289 Views
Last Modified: 2013-06-17
I have a set of XML files that I need to use in C#.

Is there a way in Visual Studio to take an xml file and create a data class for it?  I would then use c# to load the xml file into the data class.

Hopefully that makes sense.
0
Comment
Question by:rye004
3 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39243433
0
 
LVL 42

Accepted Solution

by:
sedgwick earned 250 total points
ID: 39243566
u can do it using xsd.exe tool:
run this first:
/>xsd.exe file.xml

the output will be xsd file, then u run:
/>xsd.exe file.xsd /c

that will generate cs file which mapps the xml file.
the alternative is to do it manually by mapping the xml structure by class hierarchies.
@kaufmed has provided you links to help you do it.

FYI xsd.exe generates xml elements from System.Xml (.net 1.1) not system.xml.linq(.net 3.5),
that might affect your decision whether using the tool.
anyway, its pretty easy to make the modification to system.xml.linq xml types.
0
 

Author Closing Comment

by:rye004
ID: 39253744
Thank you so much for this.  It worked perfectly.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
HTTPS jquery doesn't work 9 61
What is "public object" in C#? 3 47
Hey Audio! 3 29
Expression Evaluater 3 25
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

777 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