469,917 Members | 1,891 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,917 developers. It's quick & easy.

xsd.exe generating multiple enums for simple type of included schema file


I'm just discovering the power of xsd.exe, so maybe I'm doing
something wrong.
>From an external provider of a web service I received several xsd
schema files describing requests and responses. So there is an extra
xsd file for each response and each request as well as some base
schemas, i.e. defining a data type for a result element. Among others
this result element contains a simple enumeration type "ResultState"
which can either be "OK" or "FAILED".

If I use xsd.exe to generate .cs files from the xsd files definining
the complex elements for the requests and responses and then combine
these files in an assembly I get a build error:

The namespace 'SomeNS' already contains a definition for

I get this error multiple times as each of the response schemas
references the schema containing the definition of the Result element
which contains the simple datatype "ResultState".

I could edit all the generated .cs files and remove all but one of the
ResultState enum decl's. But I will receive every now and then an
update of the schema files as this system is still in development.

Can anybody enligthen me if I'm doing something wrong? Please note
that I have no control over the xsd schema files. I get these from the
provider of the web service. I can't generate a .cs file for the
schema defining the result element, as this schema contains no top
level element.

Thanks in advance for taking time,

Mar 15 '07 #1
2 3915
After doing some more research in the NG's I found some references to:

- xsd.exe: seems to have it's limitations

- XSDObjectGen: tool from some guy's from microsoft. Not tested as It
requires old .NET frame work and I don't want to mess around on my dev
machine. Maybe I can test it on an older notebook...

- Dingo: tested; resolves the problem by generating only one object
for the base types of my schemas. But generates wrong code for numeric
enums. I need to do some more testing here. Also regarding
compatibility in serializing and deserializing the top level objects I
need for sending/receiving parameters to the web service.

Something I wonder is why there is more than one tool from MS. Instead
of bundling their know how and activities and develop one good tool
they seem to waste their time and effort to produce multiple tools
that have some drawbacks...

Mar 16 '07 #2
Found another limitation of Dingo:

It cannot handle simple types that are restrictions, i.e. no code is
generated for

<xsd:simpleType name="CountryCode">
<xsd:restriction base="xsd:string">
<xsd:length value="2"/>

Mar 16 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Steve George | last post: by
6 posts views Thread by Stephen Cook | last post: by
9 posts views Thread by Cesar | last post: by
3 posts views Thread by Jens Müller | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.