1

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?

  • 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. – O. R. Mapper Nov 19 '18 at 18:34
1

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.

0

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.

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, privacy policy and cookie policy

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