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

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

All you have to do is create a data source using the data source default implementation defined by IltDefaultDataSource and pass the XML file to the parse method of the data source, as shown below.

IlpDataSource datasource = new IltDefaultDataSource();
datasource.parse("ShelfXMLFile.xml");

Below is an example of a shelf defined in XML format. For details about the XML elements used in this example, see Table 3.1, Elements in an XML Data File.

How to Define a Shelf 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>
</cplData>

The result looks like this:

images/shelfxml88.gif

Figure 8.1 An Array Shelf Defined in an XML File