The xmlMap XML

The xmlMaps part stores the custom schema that has been added to the workbook, and also stores the xmlMap definitions. There can be multiple schemas and xmlMaps in a single workbook.

<MapInfo SelectionNamespaces="">
    <Schema ID="Schema1">
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
            <xsd:element nillable="true" name="expense-report">
                <xsd:complexType>
                    <xsd:sequence minOccurs="0">
                        <xsd:element minOccurs="0" nillable="true" name="Person" form="unqualified">
                            <xsd:complexType>
                                <xsd:sequence minOccurs="0">
                                    <xsd:element minOccurs="0" nillable="true" type="xsd:string" name="First" form="unqualified"></xsd:element>
                                    <xsd:element minOccurs="0" nillable="true" type="xsd:string" name="Last" form="unqualified"></xsd:element>
                                    <xsd:element minOccurs="0" nillable="true" type="xsd:string" name="Title" form="unqualified"></xsd:element>
                                    <xsd:element minOccurs="0" nillable="true" type="xsd:string" name="Phone" form="unqualified"></xsd:element>
                                    <xsd:element minOccurs="0" nillable="true" type="xsd:string" name="Email" form="unqualified"></xsd:element>
                                </xsd:sequence>
                            </xsd:complexType></xsd:element>
                        <xsd:element minOccurs="0" maxOccurs="unbounded" nillable="true" name="expense-item" form="unqualified">
                            <xsd:complexType>
                                <xsd:all>
                                    <xsd:element minOccurs="0" nillable="true" type="xsd:date" name="Date" form="unqualified"></xsd:element>
                                    <xsd:element minOccurs="0" nillable="true" type="xsd:double" name="expense" form="unqualified"></xsd:element>
                                    <xsd:element minOccurs="0" nillable="true" type="xsd:string" name="description" form="unqualified"></xsd:element>
                                    <xsd:element minOccurs="0" nillable="true" name="Misc" form="unqualified">
                                        <xsd:complexType>
                                            <xsd:attribute name="misctype" form="unqualified" type="xsd:string"></xsd:attribute>
                                        </xsd:complexType>
                                    </xsd:element>
                                </xsd:all>
                                <xsd:attribute name="type" form="unqualified" type="xsd:string"></xsd:attribute>
                                <xsd:attribute name="expto" form="unqualified" type="xsd:string"></xsd:attribute>
                            </xsd:complexType>
                        </xsd:element>
                    </xsd:sequence>
                    <xsd:attribute name="currency" form="unqualified" type="xsd:string"></xsd:attribute>
                    <xsd:attribute name="detailed" form="unqualified" type="xsd:boolean"></xsd:attribute>
                    <xsd:attribute name="total-sum" form="unqualified" type="xsd:double"></xsd:attribute>
                </xsd:complexType>
            </xsd:element>
        </xsd:schema>
    </Schema>
    <Map ID="1" Name="expense-report_Map" RootElement="expense-report" SchemaID="Schema1" ShowImportExportValidationErrors="false" AutoFit="true" Append="false" PreserveSortAFLayout="true" PreserveFormat="true">
        <DataBinding FileBinding="true" DataBindingLoadMode="1"/>
    </Map>
</MapInfo>
  • /MapInfo@SelectionNamespaces ties the prefix to the actual namespace. This is used when writing xpath expressions at runtime against the XML instance structures, because the xpath expressions use namespace prefixes instead of the fully spelled out namespace.

  • /MapInfo/Schema stores the schemas for a particular XML map object. There can be multiple <Schema> elements in a workbook, one for each XML map.

  • /MapInfo/Schema@ID identifies the schema collection used to define a particular XML map object.

  • /MapInfo/Map/@ID identifies the map object.

  • /MapInfo/Map@Name is the friendly name of the map object.

  • /MapInfo/Map@RootElement is the name of the root element of the XML instance (schemas can define more than one root node).

  • /MapInfo/Map@SchemaID identifies which schema collection the map uses.

  • /MapInfo/Map@ShowImportExportValidationErrors indicates that when an XML instance is imported or exported, the schema should be used to validate the instance, and schema errors should be shown to the user.

  • /MapInfo/Map@AutoFit indicates that after refresh, all the cells should be ‘best fitted’.

  • /MapInfo/Map@Append means that when refreshed, don’t discard existing data, but append new data to it.

  • /MapInfo/Map@PreserveSortAFLayout indicates whether to keep filters on (Tables).

  • /MapInfo/Map@PreserveFormat indicates whether to keep the cell formatting applied or re-apply based on schema data type.