Hi,
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
'ResultState'
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,
Stefan
olympus_mons@gmx.de - 16 Mar 2007 17:03 GMT
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...
Stefan
olympus_mons@gmx.de - 16 Mar 2007 18:02 GMT
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"/>
</xsd:restriction>
</xsd:simpleType>