473,396 Members | 2,018 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Need help writing proper class structure based off XSD schema.

I am rather new to the XML and XSD world and was wondering what the code
would look like to write the following XSD items as classes in C# with all
the proper XML attributes to make them serializable. Thanks in advance.

<xsd:complexType name="Order">

<xsd:sequence>

<xsd:element ref="OrderHeader"/>

<xsd:element minOccurs="0" ref="OrderDetail"/>

<xsd:element minOccurs="0" ref="OrderSummary"/>

</xsd:sequence>

</xsd:complexType>

<xsd:element name="Order" type="Order"/>
Nov 16 '05 #1
2 1337
JTrigger,

You can find out for yourself, actually. You can run the XSD.EXE tool
(located in the framework directory) and point it to your XSD file. It will
then create C# source code based on the structure laid out by the XSD file.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"JTrigger" <jt******@nospam.nospam> wrote in message
news:u2**************@tk2msftngp13.phx.gbl...
I am rather new to the XML and XSD world and was wondering what the code
would look like to write the following XSD items as classes in C# with all
the proper XML attributes to make them serializable. Thanks in advance.

<xsd:complexType name="Order">

<xsd:sequence>

<xsd:element ref="OrderHeader"/>

<xsd:element minOccurs="0" ref="OrderDetail"/>

<xsd:element minOccurs="0" ref="OrderSummary"/>

</xsd:sequence>

</xsd:complexType>

<xsd:element name="Order" type="Order"/>

Nov 16 '05 #2
Yes, but the xsd tool does not create properties with setters and getters
properly. I tried the XSDObjectGenerator tool, but it creates uncompilable
code. I tried putting a post on that below, but have gotten no where. I
was hoping someone would provide me with proper code that I could then use
as a template to fix the improper code the XSDObjectGeneration tool created.

Thanks,
Jim

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:%2****************@TK2MSFTNGP09.phx.gbl...
JTrigger,

You can find out for yourself, actually. You can run the XSD.EXE tool
(located in the framework directory) and point it to your XSD file. It
will then create C# source code based on the structure laid out by the XSD
file.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"JTrigger" <jt******@nospam.nospam> wrote in message
news:u2**************@tk2msftngp13.phx.gbl...
I am rather new to the XML and XSD world and was wondering what the code
would look like to write the following XSD items as classes in C# with all
the proper XML attributes to make them serializable. Thanks in advance.

<xsd:complexType name="Order">

<xsd:sequence>

<xsd:element ref="OrderHeader"/>

<xsd:element minOccurs="0" ref="OrderDetail"/>

<xsd:element minOccurs="0" ref="OrderSummary"/>

</xsd:sequence>

</xsd:complexType>

<xsd:element name="Order" type="Order"/>


Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Tad Marko | last post by:
Howdy! I'm trying to get my head around Python and I've come to realize that there are a lot of idioms in Python that are a bit different than in other languages. I have a class similar to what...
9
by: sk | last post by:
I have an applicaton in which I collect data for different parameters for a set of devices. The data are entered into a single table, each set of name, value pairs time-stamped and associated with...
2
by: JTrigger | last post by:
I am rather new to the XML and XSD world and was wondering what the code would look like to write the following XSD items as classes in C# with all the proper XML attributes to make them...
1
by: dpakpaul | last post by:
Hi, I have an XSD schema where I have attributes that are declared to contain non string values such as integers etc. Take for example, this declaration - <xs:attribute name="IsThisTrue"...
1
by: Miguel Isidoro | last post by:
I generated a .cs class from a .xsd schema using the xsd.exe tool from Visual Studio 2005 and noticed that is generating duplicate class declarations. This happens because of my schema structure. I...
9
by: Tony Girgenti | last post by:
Hello I developed and tested a web application using VS.NET 2003, VB, .NET Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1. It uses a web form. I tried doing this without any help, but i'm...
0
by: RYoung | last post by:
Hi all, Hope no one minds this long message, but I'm puzzled: --------------- The following is a shortened version of schema located at...
1
by: Thomas | last post by:
Does anyone have a best practices recommendation on writing a valid XML document based on a 3rd party XML schema? I have a working solution but I would like to know if anyone has a better...
2
by: nirmalc | last post by:
Question 1: XYZ Company is a Car production company. It has four factories and many distribution outlets spread across the country. The company keeps online records of the sales of its cars. It also...
2
by: NITHYA LATHA | last post by:
XYZ Company is a Car production company. It has four factories and many distribution outlets spread across the country. The company keeps online records of the sales of its cars. It also creates...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.