Reputation: 12658
I am looking for a tool (preferably freeware) which can help me to create C# DTOs(classes) from multiple xml files.
Some of these xml files contains same complex type so to avoid duplication of classes i have to make one XSD from multiple files.
I tried xsd.exe (provided with visual studio) tool but it doesn't takes multiple xml files.
please help.
Upvotes: 0
Views: 786
Reputation: 21638
QTAssistant (I am associated with it) has a command under the Tools tab, in the XML section, called "XSD from XMLs". It prompts you for:
The tool is based on .NET techologies, and so the style of the generated output is .NET's, and the version is limited to XSD 1.0.
The tool is free to try, albeit it requires registration for support reasons. If you don't want to register, send me an email using the support contact info on the site and I'll send you a private link.
For example, if you take a look at the XMLs posted with this question on SO, then QTAssistant will be generating this XSD:
The reason I am pointing this out has to do with expectation you might have regarding the generated XSD content. If you take a look at the choice in the above diagram, while it matches the requirement put forward by the user, it may also not for others...
So for this type of exercise it is important to use as many XMLs as valid scenarios you have in mind. Given how inference work, you should expect that some unwanted XML patterns "slip" through the generated XSDs; in which case, you can try to edit some bits by hand... if it doesn't work, blame the XSD specification for its limitations...
Upvotes: 1