views:

267

answers:

1

Halo

I'm sure this question has been asked many times in the past, but I'm having a nightmare with it.

I have a set of XSD schemas with a tonne of complex types. One of them is this:

<complexType name="commandType">
  <sequence>
    <choice>
      <element name="check" type="epp:readWriteType"/>
    </choice>
  </sequence>
</complexType>

But, "check" should actually be a "checkType"....but it can't be, because doing this would create some kind of mad looping in the includes files, so the design tools just don't let you do this. So, readWriteType was put in presumably to be a class that perhaps checkType derives from (I don't know, I could be lying).

readWriteType however, looks like this:

<complexType name="readWriteType">
  <sequence>
    <any namespace="##other"/>
  </sequence>
</complexType>

So the code generation tools just haven't got a clue what to do with it, or how checkType relates to readWriteType. It's mighty frustrating.

Anyway, was just hoping someone on here might have a brainwave!

Oh, XSD.exe doesn't work with these classes so I'm trying to work with some third party tools, something about needing element before complexType.

Thanks, P

+1  A: 

I don't see how you can solve this - as long as you use the <any> element type, the generated code will always be rather generic and use a lot of object elements.

Why can't you make the element check be of type checkType ? That really is the only way to get things straightened out - if you have clearly defined types, then the code generation can do something about it.

Marc

marc_s
Yeah, I was hoping to be able to use "checkType" as the type for check, but it doesn't validate.file1.xsd contains the commandType complexTypefile2.xsd contains the checkType complexType, and includes file1.xsd a the topBecause of this, I can't include file2.xsd at the top of file1.xsd, meaning checkType doesn't exist as an available type in file1.xsd
Paul