Business Objects and Data Sources > Shelves and Cards > Card Carriers > Loading a Card Carrier Defined in XML

This section shows how to load a card carrier from an XML file in a data source. For detailed information about data sources, see section Data Sources.

The example below creates a card carrier with a card and adds it to a shelf. Note the tags <parent> and </parent>, which define the parent object of the card items, and the attribute slotCount, which defines the number of slots for the card carrier.

Note
The positioning of an object in a card carrier is given by an IlpPoint, not by an IlpShelfItemPosition as in the shelf.

For details about the XML elements used in this example, see Table 3.1, Elements in an XML Data File.

How to Load a Card Carrier Defined in XML
<cplData>
<addObject id="Shelf">
  <class>ilog.tgo.model.IltShelf</class>
  <attribute name="name">Shelf</attribute>
  <attribute name="slotSizes" javaClass="ilog.cpl.equipment.IlpSlotSizes">
    <width>
      <value>30</value>
      <value>20</value>
      <value>40</value>
    </width>
    <height>
      <value>90</value>
      <value>20</value>
    </height>
  </attribute>
  <attribute name="position" javaClass="ilog.cpl.graphic.IlpPoint">
    <x>100</x> <y>50</y>
  </attribute>
</addObject>
<addObject id="Carrier">
  <class>ilog.tgo.model.IltCardCarrier</class>
  <parent>Shelf</parent>
  <attribute name="name">Carrier</attribute>
  <attribute name="slotCount" javaClass="java.lang.Integer">2</attribute>
  <attribute name="position"
          javaClass="ilog.cpl.graphic.views.IlpShelfItemPosition">
    <x>1</x> <y>0</y> <width>2</width> <height>2</height>
  </attribute>
</addObject>
<addObject id="Card">
  <class>ilog.tgo.model.IltCard</class>
  <parent>Carrier</parent>
  <attribute name="name">Card</attribute>
  <attribute name="position" javaClass="ilog.cpl.graphic.IlpPoint">
    <x>0</x> <y>1</y>
  </attribute>
</addObject>
</cplData>

The result looks like this:

images/cardcarrierxml97.gif

Figure 8.10 An Array Shelf with a Card Carrier and a Card