Jump to content

XML schema for a database exchange format


Manni1

Recommended Posts

Hello, I want to create an exchange format for copying database objects. After reading some articles about XML schemas I got the impression that I could use XML files for this. Before really starting the implementation I created an XML schema. A very much shortened version is shown here (Verfahren and Verfahrensbeteiligung are tables of the database schema, VER_KEY_ID and VBG_KEY_ID are primary keys and the corresponding foreign keys referencing them) :

<?xml version="1.0" encoding="UTF-8"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">	<xs:element name="Verfahrensdaten">		<xs:annotation>			<xs:documentation>Wurzelelement</xs:documentation>		</xs:annotation>		<xs:complexType>			<xs:sequence>				<xs:element name="Verfahren">					<xs:complexType>						<xs:sequence>							<xs:element name="VER_KEY_ID" type="xs:integer" nillable="false"/>						</xs:sequence>					</xs:complexType>				</xs:element>				<xs:element name="Verfahrensbeteiligung" minOccurs="0" maxOccurs="unbounded">					<xs:complexType>						<xs:sequence>							<xs:element name="VBG_KEY_ID" nillable="false"/>							<xs:element name="VER_KEY_ID" type="xs:integer"/>						</xs:sequence>					</xs:complexType>				</xs:element>			</xs:sequence>		</xs:complexType>		<xs:key name="Verfahren_VER_KEY_ID">			<xs:selector xpath="Verfahren"/>			<xs:field xpath="VER_KEY_ID"/>		</xs:key>		<xs:keyref name="Ref_Verfahren" refer="Verfahren_VER_KEY_ID">			<xs:selector xpath="Verfahrensbeteiligung|Verfahrensbeteiligung111"/>			<xs:field xpath="VER_KEY_ID"/>		</xs:keyref>	</xs:element></xs:schema>

A XML file which is generated from this XML schema is e.g. :

<?xml version="1.0" encoding="UTF-8"?><Verfahrensdaten xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Verfahrensdaten.xsd"><Daten>	<Verfahrensdaten>		<Verfahren>			<VER_KEY_ID>99</VER_KEY_ID>		</Verfahren>		<Verfahrensbeteiligung>			<VBG_KEY_ID>1</VBG_KEY_ID>			<VER_KEY_ID>99</VER_KEY_ID>		</Verfahrensbeteiligung>		<Verfahrensbeteiligung>			<VBG_KEY_ID>2</VBG_KEY_ID>			<VER_KEY_ID>99</VER_KEY_ID>		</Verfahrensbeteiligung>	</Verfahrensdaten></Daten>

Of course, in reality there are more tables and for each of them more attributes.Are there experiences with such a type of exchange format ? Is XML an option which makes sense at all for exporting and importing database tables from one database to another ?

Link to comment
Share on other sites

  • 2 months later...

Hello,I was a bit surprised to see that nobody has still answered to my problem. I thought that exchanging objects between databases is one of the main applications for XML files. Maybe this is only theory and one day everybody will say : "Of course theoretically this was one of the main applications, but in practice it could not be managed to adapt the XML schema to changes of the database schema(s). Often it was too complex to do this manually, and there were no tools for managing this automatically." This idea I got when I read the articles of mojojojo (Tools for schemas).But nevertheless I am looking forward to posts from readers having some experiences in exporting and importing database tables with an XML based exchange format (or some other format).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...