Defining the database channel

XML data alone is not enough to describe a database. For each XML file you create, you also must create an XML Schema Definition (XSD) document, just as a table in a database requires a schema to describe the fields within the table. M-Business Client supports the W3C standard XML Schema, which provides element-centric or attribute-centric formatting for schemas.

Each M-Business XML conduit channel describes a single database table. You must create an XSD file and an M-Business Server database channel for each table you want to synchronize.

To be valid, the XSD file must meet the following guidelines:

  • The name attribute must be unique. For example, 'uint32Field' could be 'myBirthDate', or 'stringField' could be 'addressLine1'.

  • The 'theKeyField' can be any column in the table.

  • You are required to have a primary key field in the table. It can have any name, just modify the line, <xsd:field xpath="@theKeyField"/>, to match your column name.

    The sample XML and XSD documents below illustrate the format and supported data types you should use when creating the XML and XSD files that will describe your database channel.

Sample XML document
<xsd:schema xmlns:msch="urn:schemas-microsoft-com:mapping-schema" 
    xmlns:dt="urn:schemas-microsoft-com:datatypes" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
<?xml version="1.0" encoding="utf-8"?>
<Root>
    <Contacts ID="1" First="Halle" Last="Berry" 
        Phone="510-555-2100" 
        Email="hberry@localhost" Web="hberry" /> 
    <Contacts ID="2" First="Sean" Last="Connery" 
        Phone="510-555-2101" 
        Email="sconnery@localhost" Web="sconnery" /> 
    <Contacts ID="3" First="Abe" Last="Vigoda" 
        Phone="44(0) 2077764235" 
        Email="avigoda@localhost" Web="avigoda" /> 
    <Contacts ID="4" First="A" Last="Godzilla" 
        Phone="800-000-0000" 
        Email="godzilla@localhost" Web="godzilla" /> 
</Root>
Sample XSD document
<xsd:schema xmlns:msch="urn:schemas-microsoft-com:mapping-schema" 
    xmlns:dt="urn:schemas-microsoft-com:datatypes" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
<xsd:element 
    name="Contacts" 
    type="Contacts_type" 
    msch:relation="Contacts"/> 
<xsd:complexType name="Contacts_type"> 
    <xsd:attribute name="ID" type="xsd:string"/> 
    <xsd:attribute name="First" type="xsd:string"/> 
    <xsd:attribute name="Last" type="xsd:string"/> 
    <xsd:attribute name="Phone" type="xsd:string"/> 
    <xsd:attribute name="Email" type="xsd:string"/> 
    <xsd:attribute name="Web" type="xsd:string"/> 
    xsd:key name="PrimaryKey"> 
        <xsd:selector xpath="."/> 
        <xsd:field xpath="@ID"/> 
    </xsd:key> 
    </xsd:complexType> 
    </xsd:schema>

The above sample XSD document works with the sample data in the Sample XSD document. For a complete list of the XSD data types that are supported, see Creating the XSD file.