473,614 Members | 2,328 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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:complexTyp e name="Order">

<xsd:sequence >

<xsd:element ref="OrderHeade r"/>

<xsd:element minOccurs="0" ref="OrderDetai l"/>

<xsd:element minOccurs="0" ref="OrderSumma ry"/>

</xsd:sequence>

</xsd:complexType >

<xsd:element name="Order" type="Order"/>
Nov 12 '05 #1
2 1459
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.co m

"JTrigger" <jt******@nospa m.nospam> wrote in message
news:u2******** ******@tk2msftn gp13.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:complexTyp e name="Order">

<xsd:sequence >

<xsd:element ref="OrderHeade r"/>

<xsd:element minOccurs="0" ref="OrderDetai l"/>

<xsd:element minOccurs="0" ref="OrderSumma ry"/>

</xsd:sequence>

</xsd:complexType >

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

Nov 12 '05 #2
Yes, but the xsd tool does not create properties with setters and getters
properly. I tried the XSDObjectGenera tor 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 XSDObjectGenera tion tool created.

Thanks,
Jim

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:%2******** ********@TK2MSF TNGP09.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.co m

"JTrigger" <jt******@nospa m.nospam> wrote in message
news:u2******** ******@tk2msftn gp13.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:complexTyp e name="Order">

<xsd:sequence >

<xsd:element ref="OrderHeade r"/>

<xsd:element minOccurs="0" ref="OrderDetai l"/>

<xsd:element minOccurs="0" ref="OrderSumma ry"/>

</xsd:sequence>

</xsd:complexType >

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


Nov 12 '05 #3

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

Similar topics

9
2919
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 a device. The definition of the table is as follows: CREATE TABLE devicedata ( device_id int NOT NULL REFERENCES devices(id), -- id in the device
1
4136
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" type="xs:boolean" /> Now, I want to write or modify an XML document using the DOM API (using C#) where this attribute will be given a boolean value. Then the resulting XML document will be validated against the schema
2
1352
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 serializable. Thanks in advance. <xsd:complexType name="Order"> <xsd:sequence> <xsd:element ref="OrderHeader"/>
1
2757
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 have an element, <QuestionList>, that is a set of <Questionelements that is defined at the root of the schema and but it can also be defined as child of an element <QuestionGroup>. The tool, instead of generation a class for the QuestionList...
9
1603
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 getting nowhere. I want to create an XML schema (XSD) for a dataset/datatable using the XML designer.
0
1204
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 http://www.ietf.org/internet-drafts/draft-ietf-inch-iodef-10.txt <xs:schema xmlns="urn:ietf:params:xml:ns:iodef-1.0" xmlns:iodef="urn:ietf:params:xml:ns:iodef-1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"
1
2807
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 approach. My solution: 1) Pull the data from the database into datatables (in my case, this is DB2). 2) Validate all required data columns (I've written a method that iterates through all the datatables rows and throws an exception if
2
1649
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 creates batched Production schedules on the basis of the sales of the car. The car production is done at a nearest factory so that the cost of transfer of cars to distribution centre is minimized. Each factory also maintains its inventory. The...
2
1472
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 batched Production schedules on the basis of the sales of the car. The car production is done at a nearest factory so that the cost of transfer of cars to distribution centre is minimized. Each factory also maintains its inventory. The company...
0
8198
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8142
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8642
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8591
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8294
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
4138
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2575
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1438
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.