Need help writing proper class structure based off XSD schema.

J

JTrigger

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"/>
 
N

Nicholas Paldino [.NET/C# MVP]

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.
 
J

JTrigger

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 said:
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]
- (e-mail address removed)

JTrigger said:
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"/>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top