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

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

The example below extends the example presented in the section Loading a Shelf Defined in XML and adds a card to the shelf. Note the tags <parent> and </parent>, which define the parent object of the card. Note also that the positioning of an object in a shelf is given by an IlpShelfItemPosition, which defines its slot indices and span.

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

How to Add a Card to a Shelf 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="Card0">
  <class>ilog.tgo.model.IltCard</class>
  <parent>Shelf</parent>
  <attribute name="name">Card0</attribute>
  <attribute name="position"
                   javaClass="ilog.cpl.graphic.views.IlpShelfItemPosition">
    <x>0</x> <y>0</y> <width>1</width> <height>1</height>
  </attribute>
</addObject>
</cplData>

The result looks like this:

images/cardxml91.gif

Figure 8.4 An Array Shelf with a Card from an XML File