You phrase the question as if for any XML instance there is one schema, and for any schema there is one instance. A schema describes a class of documents. There are an infinite number of schemas that describe a given instance, and for most schemas there will be an infinite number of instances that are valid against that schema. So the best you will get is a "reasonable" schema for a given instance, and a "typical specimen" instance for a given schema. I think you will find tools that provide these in many XML IDEs such as oXygen.