Inventory.xsd Schema

The inventory.xsd file defines how to structure the XML file that transmits inventory data to Salesforce B2C Commerce. This file defines the Inventory List record and its associated Product Inventory Records.

The inventory.xml file can contain 0 or more inventory lists.

Inventory List Record

<xsd:complexType name="complexType.Header">
<xsd:sequence>

An inventory list must always have a value for the default product availability flag.

<xsd:element name="default-instock" type="xsd:boolean" minOccurs="1" maxOccurs="1" />

The description field is optional and up to 4000 characters.

    <xsd:element name="description" 
        type="simpleType.Generic.String.4000" minOccurs="0" maxOccurs="1" />
</xsd:sequence>

The list ID is required and up to 256 characters.

<xsd:attribute name="list-id" type="simpleType.Generic.NonEmptyString.256" use="required" />

The import mode is optional.

   <xsd:attribute name="mode" type="simpleType.ImportMode" use="optional" />
</xsd:complexType>

The list can contain zero or more inventory records.

<xsd:complexType name="complexType.InventoryRecords">
    <xsd:sequence>
        <xsd:element name="record" type="complexType.InventoryRecord" 
            minOccurs="0" maxOccurs="unbounded" />
    </xsd:sequence>
</xsd:complexType>

Product Inventory Records

    <xsd:complexType name="complexType.InventoryRecord">
        <xsd:sequence>

The allocation, perpetual, preorder-backorder-handling, preorder-backorder-allocation, in-stock-date, ats, on-order, turnover, and custom-attribute fields of an inventory record are optional.

     <xsd:complexType name="complexType.InventoryRecord">
        <xsd:sequence>
            <xsd:element name="allocation" type="simpleType.Allocation" minOccurs="0" maxOccurs="1" />
            <xsd:element name="allocation-timestamp" type="xsd:dateTime" minOccurs="0" maxOccurs="1" />
            <xsd:element name="perpetual" type="xsd:boolean" minOccurs="0" maxOccurs="1" />
            <xsd:element name="preorder-backorder-handling" type="simpleType.InventoryRecord.PreorderBackorderHandling" minOccurs="0" maxOccurs="1" />
            <xsd:element name="preorder-backorder-allocation" type="simpleType.Allocation" minOccurs="0" maxOccurs="1" />
            <xsd:element name="in-stock-date" type="xsd:date" minOccurs="0" maxOccurs="1" />
            <xsd:element name="ats" type="simpleType.Allocation" minOccurs="0" maxOccurs="1" />
            <xsd:element name="on-order" type="simpleType.Allocation" minOccurs="0" maxOccurs="1" />
            <xsd:element name="turn-over" type="simpleType.Allocation" minOccurs="0" maxOccurs="1" />
            <xsd:element name="custom-attributes" type="sharedType.CustomAttributes" minOccurs="0" maxOccurs="1" />
        </xsd:sequence>
        <xsd:attribute name="product-id" type="simpleType.Generic.NonEmptyString.100" use="required" />
        <xsd:attribute name="mode" type="simpleType.ImportMode" use="optional" />
    </xsd:complexType>

Product IDs are required.

        <xsd:attribute name="product-id" 
                type="simpleType.Generic.NonEmptyString.256" use="required" />
    </xsd:complexType>
    

Allocation contains a decimal value greater than or equal to "0.0".

    <xsd:simpleType name="simpleType.Allocation">
        <xsd:restriction base="xsd:decimal">
            <xsd:minInclusive value="0.0" />
        </xsd:restriction>
    </xsd:simpleType>

ImportMode defaults to "delete".

    <xsd:simpleType name="simpleType.ImportMode">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="delete" />
        </xsd:restriction>
    </xsd:simpleType>

The preorder backorder handling field must be equal to "none", "preorder" or "backorder".

    <xsd:simpleType name="simpleType.InventoryRecord.PreorderBackorderHandling">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="none" />
            <xsd:enumeration value="preorder" />
            <xsd:enumeration value="backorder" />
        </xsd:restriction>
    </xsd:simpleType>

This defines a "simpleType.Generic.String", which is the basis for the next three definitions.

    <xsd:simpleType name="simpleType.Generic.String">
        <xsd:restriction base="xsd:string" />
    </xsd:simpleType>

This defines an optional string with a maximum length of 256 characters.

    <xsd:simpleType name="simpleType.Generic.String.256">
        <xsd:restriction base="simpleType.Generic.String">
            <xsd:minLength value="0" />
            <xsd:maxLength value="256" />
        </xsd:restriction>
    </xsd:simpleType>

This defines an optional string with a maximum length of 4000 characters.

    <xsd:simpleType name="simpleType.Generic.String.4000">
        <xsd:restriction base="simpleType.Generic.String">
            <xsd:minLength value="0" />
            <xsd:maxLength value="4000" />
        </xsd:restriction>
    </xsd:simpleType>

This defines a non-empty string with a maximum length of 256 characters.

    <!--  Nonempty string with no leading or trailing whitespace -->
    <xsd:simpleType name="simpleType.Generic.NonEmptyString.256">
        <xsd:restriction base="simpleType.Generic.String">
            <xsd:minLength value="1" />
            <xsd:maxLength value="256" />
            <xsd:pattern value="\S(.*\S)*" />
        </xsd:restriction>
    </xsd:simpleType>
</xsd:schema>