Class representation of a xsd

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi guys I have the following XSD and need a C# class. I have tried xsd.exe and xsd2code however they throw the error raised in my other thread topic.

<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <?<span style="color:#A31515; xml <span style="color:Red; version<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 1.0<span style="color:Black; " <span style="color:Red; encoding<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; UTF-8<span style="color:Black; "<span style="color:Blue; ?>
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; schema
<span style="color:Red; xmlns:xs<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; http://www.w3.org/2001/XMLSchema<span style="color:Black; "
<span style="color:Red; xmlns:xhtml<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; http://www.w3.org/1999/xhtml<span style="color:Black; "
<span style="color:Red; xmlns:xml<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; http://www.w3.org/XML/1998/namespace<span style="color:Black; "
<span style="color:Red; elementFormDefault<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; qualified<span style="color:Black; "<span style="color:Blue; >

<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; import <span style="color:Red; namespace<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; http://www.w3.org/1999/xhtml<span style="color:Black; " <span style="color:Red; schemaLocation<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd<span style="color:Black; " <span style="color:Blue; />
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; import <span style="color:Red; namespace<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; http://www.w3.org/XML/1998/namespace<span style="color:Black; " <span style="color:Red; schemaLocation<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; http://www.w3.org/2001/xml.xsd<span style="color:Black; "<span style="color:Blue; />

<span style="color:Green; <!-- This schema defines some common type definitions reused in other schemas -->
<span style="color:Green; <!-- Note this is a "chameleon" schema - the types will take on the NS of the schema that includes them -->

<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; simpleType <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; dateOrDateTimeDType<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; union <span style="color:Red; memberTypes<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; xs:date xs:dateTime<span style="color:Black; " <span style="color:Blue; />
<span style="color:Blue; </<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; simpleType<span style="color:Blue; >

<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; complexType <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; descriptionDType<span style="color:Black; " <span style="color:Red; mixed<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; true<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; sequence<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; element <span style="color:Red; ref<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; xhtml:div<span style="color:Black; " <span style="color:Red; minOccurs<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 0<span style="color:Black; " <span style="color:Blue; />
<span style="color:Blue; </<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; sequence<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; attribute <span style="color:Red; ref<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; xml:lang<span style="color:Black; " <span style="color:Red; use<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; optional<span style="color:Black; " <span style="color:Blue; />
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; attribute <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; href<span style="color:Black; " <span style="color:Red; type<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; xs:anyURI<span style="color:Black; " <span style="color:Red; use<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; optional<span style="color:Black; " <span style="color:Blue; />
<span style="color:Blue; </<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; complexType<span style="color:Blue; >

<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; complexType <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; vocabularyDType<span style="color:Black; " <span style="color:Red; mixed<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; true<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; attribute <span style="color:Red; ref<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; xml:lang<span style="color:Black; " <span style="color:Red; use<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; optional<span style="color:Black; " <span style="color:Blue; />
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; attribute <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; identifier<span style="color:Black; " <span style="color:Red; use<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; optional<span style="color:Black; " <span style="color:Blue; />
<span style="color:Blue; </<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; complexType<span style="color:Blue; >

<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; complexType <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; subjectDType<span style="color:Black; " <span style="color:Red; mixed<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; true<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; attribute <span style="color:Red; ref<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; xml:lang<span style="color:Black; " <span style="color:Red; use<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; optional<span style="color:Black; " <span style="color:Blue; />
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; attribute <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; identifier<span style="color:Black; " <span style="color:Red; use<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; optional<span style="color:Black; " <span style="color:Blue; />
<span style="color:Blue; </<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; complexType<span style="color:Blue; >

<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; complexType <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; temporalDType<span style="color:Black; " <span style="color:Red; mixed<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; true<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; attribute <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; dtf<span style="color:Black; " <span style="color:Red; use<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; optional<span style="color:Black; " <span style="color:Red; type<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; dateOrDateTimeDType<span style="color:Black; "<span style="color:Blue; />
<span style="color:Blue; </<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; complexType<span style="color:Blue; >

<span style="color:Blue; </<span style="color:#A31515; xs<span style="color:Blue; :<span style="color:#A31515; schema<span style="color:Blue; >
[/code]

<br/>
Anyone got any points on how I go about creating the class and the associated imports and attributes. I understand that I can create a simple class and then use xsd to convert, however I am unsure on how to add the imports and attributes in the c# class
so that they then appear in the xsd generated xsd document. Thank you.

Kelvin


View the full article
 
Back
Top