2

I process XML requests using a web service. Many times my clients would want the XSD along with the request XML so that they can validate the XML before sending the request.

Is there any tool open source you can recommend to generate the XSD from the XML file?

1
  • The point raised in Kodiologist's answer is very relevant. Just to make this more explicit: By "my clients would want the XSD along with the request XML", you do mean they create and send the request XML after you gave them the XSD, right? Be aware that they will probably expect that your code will be able to meaningfully process any XML that is valid based on the XSD, and nothing beyond. Nov 19, 2018 at 18:34

3 Answers 3

2

Your clients are asking for a schema that you wrote for the purpose and know is correct, so they can check, before sending a request, that it's what your service supports. Automatically generating a schema from some sample requests would only produce a description of the sample, not a precise specification of what you support.

1

I've used the generators in oXygen and Stylus Studio and both do a reasonable job -- but you should be prepared to edit the output by hand afterwards. There's no way, for example, if your sample data contains the values "Monday", "Thursday", and "Friday" for a particular field, that the software can guess what the full set of permissible values is.

1
  • It is unfortunate both oXygen and Stylus Studio are paid tools, but they do at least have free trial periods. You can even use Stylus Studio without giving away your email - you can click "Later" on the initial pop-up to access the tool. Nov 3, 2022 at 17:37
0

Google xml2xsd and you will find several, including https://www.freeformatter.com/xsd-generator.html. that one supports 3 styles of schema

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.