Tool that can combine many XSD files into one?

For future references, another tool designed for XML Schema refactoring is QTAssistant - I am associated with it.

To clarify your question and hopefully help others... One thing that cannot be achieved as requested by you is that one cannot de-reference imports: an XSD file is associated with one XML Schema which doesn't allow more than one target namespace per xsd:schema element.

An xsd:include can be "inlined"; since files must have the same target namespace or match the "chameleon" namespace design approach, it is possible to merge the content of a file into the other.

An xsd:import cannot be "inlined"... unless you refactor target namespaces as well. However, this would not produce an equivalent schema set.

If you have a fully defined XML Schema set authored across 65 XSD files, with say 10 namespaces, the "canonical" set of re-factored XML Schema files has to have at least 10 files in it.


What you can do is to create another new file called file.xsd containing all the schema names in it and then the trick is to name the last schema file with .\ as prefix.

File.xsd

<xsd xmlns='http://microsoft.com/dotnet/tools/xsd/'>
    <generateClasses language='CS' namespace='MyNamespace'>
        <schema>First.xsd</schema>
        <schema>Second.xsd</schema>
        <!-- more schema files here -->
        <schema>.\Third.xsd</schema>
    </generateClasses>
</xsd>

Now run the command “xsd.exe /p:file.xsd /classes” and you get the class file generated :)