I want to generate XML Schemas (.xsd file) for MySQL Database tables. This will provide an alternative generic interface to interact with other apps.
(1) Since XMLSpy 2011 is a perfect tool to do, so I don’t need to manually generate the XML Schema from tables.
(2) Download XMLSpy 2011 from http://www.altova.com/xmlspy/. try version is enough.
(3) I have already installed MySQL DB. So next is to connect MySQL with XMLSpy.
(4) To do this, a ODBC connector is needed which is a standard driver in Windows Platform.
from http://dev.mysql.com/downloads/ to download mysql-connector-odbc-5.1.8-win32.msi, then installed it.
(5) OPen XML Spy 2011, follow next steps:
(5.a) Select ‘Create XML Schema from DB Structure’ from the XMLSpy ‘Convert’ menu.
(5.b) If it is not automatically selected, highlight the Connection Wizard icon at the upper left of the dialog to connect to a known database.
(5.c) Choose the radio button for database type and click ‘Next’.
(5.d) The next steps vary in details based on the database type you choose, but you will be offered a list of databases already known on the system.
Choose one and complete the connection.
(5.e) A hierarchical tree of the database tables will be displayed. Simply choose the tables you want, modify any settings in the Options tab as necessary, and click ‘Import’.
(5.f) The XML schemas is generated, save it as .xsd extension.
(6) That’s it. How many .xsd files to generate? It doesn’t matter, depending your requirement. There are 2 choices.
(6.a) Generate a individual .xsd file for each table
(6.b) Or for whole tables, to generate a .xsd file (which include all selected tables definition).
A helpful article is available at: http://www.altova.com/technote10.html
With these .xsd files, it is easy to extend apps for different purposes, which usually is widely used in B2B services.