chobok chobok - 1 year ago 75
Python Question

What Python accessible tools can you use to generate XSD from an XML document?

I'm looking for a tool that will play nicely with Python.
Except for my Python requirement, my question is the same as this one:

"I am looking for a tool which will take an XML instance document and output a corresponding XSD schema."

Answer Source

Currently, there is no module that will run within your python program and do this conversion. But I see the problem of creating a XSD schema from XML as a tooling problem. It's the kind of functionality that I'll use once, to get a schema started but after that I'll be maintaining the schema myself. From reading a single XML file the XSD generator will create a starting point for a real schema, it cannot infer all the functionality and options offered by XSD. Basically, I don't see the need to have this conversion run as a module inside of my code, generating new XSDs every time the XML changes. After all, it's the schema that defines the XML not the other way around.

As end-user pointed out you could use xsd.exe but you might also want to look at other tools such as trang (a bit old) for Java and stylusstudio (XML tool).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download