views:

21

answers:

1

I am trying to generate a C# class based on an .xsd schema. This schema has several imports which I included on the command line in my batch file. It also has includes that should be resolved by using the schemaLocation to find the file on the disk. I am getting errors for several types that are supposedly not declared. These definitions are in the "included" schemas in a folder beneath the schema where the value is used.

A: 

If you have the included schemas, XSD.EXE handles this fairly well, but you have to dig to find the documentation.

Look at this link in the poriton about using an XML file to direct XSD.EXE. The short version is that you'll create a small xml file with multiple <Schema> nodes which point to: the schema for which you actually need schemas AND the imported schemas.

Then you'll run XSD.EXE /p [yourXsdFile.xsd]. If you've follwed the instructions correctly (I've only done it once, so I'm no expert, and it took me a couple of tries to get the results I wanted) you'll get a single .cs file with all the necessary class data.

AllenG
I've seen an implementation of using the XML file and this saves you from listing every referenced schema on the command line and this is for imports. My problem is that I have an include that then includes 10 other schemas. These can't be explicitly listed b/c they're all essentially in the same namespace. However, the xsd.exe doesn't resolve the path and utilize the schemas.
jmac