Creating the XSD file

When you have a simple, non-changing schema, as in this example, you can create the schema once and vend it to the M-Business XML conduit from a static file. When you are creating a more complex application, you might generate the XSD file dynamically from the back-end data source. The sample code below shows the XSD file for this application. The table below that lists the data types that are supported in XSD files.

Sample XSD file
<?xml version="1.0" encoding="UTF-8" standalone="no" ?> 
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns:dt="urn:schemas-microsoft-com:datatypes" 
    xmlns:msch="urn:schemas-microsoft-com:mapping-schema"> 
        <xsd:element name="Employees" msch:relation="Employees"
        type="Employees_type" /> 
        <xsd:complexType name="Employees_type"> 
            <xsd:attribute name="id" type="xsd:int" />
            <xsd:attribute name="lastname" type="xsd:string" /> 
            <xsd:attribute name="firstname" type="xsd:string" /> 
            <xsd:attribute name="phonenumber" type="xsd:string" /> 
                <xsd:key name="PrimaryKey"> 
                    <xsd:selector xpath="." /> 
                    <xsd:field xpath="@id" /> 
                </xsd:key>
        </xsd:complexType>
</xsd:schema>
Note

You can find the sample code shown in the figure above in the employees.xsd file, which is available in DB_sample.zip file on the M-Business Anywhere Product Manuals page, referenced in Related publications.

Table 1. Supported data types in XSD files

Data type

XSD type specification

64-bit unsigned integer

type = "xsd:double"

32-bit signed integer

type = "xsd:int"

32-bit unsigned integer

type = "xsd:unsignedInt"

16-bit signed integer

type = "xsd:short"

16-bit unsigned integer

type = "xsd:unsignedShort"

character string (32kB maximum size)

type = "xsd:string"

boolean value (valid values: "true", "false" )

type = "xsd:boolean"

date/time value (supports dates from January 1, 1902, to January 1, 2038—format is: YYYY:MM:DD:T:hh:mm:ss)

type = "xsd:datetime"