Question

I have orbitz (global hotel distribution system) xsd schema and want to generate c#.Net classes from these xsd files.

When I use Xsd.Exe or XSD2Code or something else, generated classes copies complex types from imported files to inside, so multiple files has the same classes.

I'm confused, what to do?

You can download xsd schema files from below link. I need working c# classes of xsd files in "hotel" folder.

After generation of xsd files, please add these .cs files to a project and see the errors.

Thanks

XSD FILES =>http://rapidshare.com/files/1062702005/orbitz-pws-schemas-1.42.zip

Was it helpful?

Solution 2

Thanks Petru, I found my answer through another channel.

I put the files into same folder, and changed import file locations to the same folder because xsd.exe requires files to be in same folder.

Then below command generates the exact c# library.

xsd.exe /c /f /l:cs /namespace:Schema common.xsd hotel_common.xsd hotel_shopping.xsd hotel_raterules_RQ.xsd hotel_raterules_RS.xsd hotel_itinerary_RQ.xsd hotel_itinerary_RS.xsd hotel_booking_RQ.xsd hotel_booking_RS.xsd hotel_cancel_RQ.xsd hotel_cancel_RS.xsd hotel_precancel_RQ.xsd hotel_precancel_RS.xsd hotel_deals_RQ.xsd .\hotel_deals_RS.xsd

OTHER TIPS

Your scenario is very much the same as the one for which I've posted this solution, also on SO. I've tried it, too, for your scenario, and I get generated code which compiles properly.

Your problem has to do with limitations in xsd.exe. The workaround is to refactor the XSDs in such a way that it captures all the scope you want to handle using the minimum number of XSD files (without use of xsd:include), and then run the generator.

In your case, this is what you have:

QTAssistant showing Orbitz XSD file relationships

This is what the refactored XSDs look like:

QTAssistant showing XSR refactored Orbitz file relationships

The xsd.exe command line looks something like this (omitted full path):

xsd.exe Vendor.xsd Hotel.xsd Air.xsd DynamicPackaging.xsd Car.xsd Common.xsd /language:CS /classes /out:xsd2code

The generated code compiles without any issues.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top