Data Structure Concepts

This chapter explains the data structures that are regularly used in FOX modules in further detail.

MINI WALK-THROUGH

  1. Open your copy of XX_ORDERMODULE.xml in XML Spy (where XX are your initials).
  2. View it in text view and navigate to schema/annotation/appinfo/module/template-list.

The template list has been pre-populated with an example for convenience. In practice, data is usually loaded from the database or constructed by FOX. This module will be referenced throughout this sheet.

CONCEPTS

What is a simple type?

This refers to a single element in the schema. These are leaf nodes when viewing the schema in the Schema (tree) View. For example, Customer Name is a simple type in the template “tmpl-order”. If the Customer Name element existed in the schema, depending on what view you are in, it would look like the following:

<xs:element name="CUSTOMER_NAME" type="xs:string"/>

 

What is a complex type?

A complex type is an element that has one or more sub-elements contained within it. These are branches when viewing the schema in the Schema (tree) View. For example, Order Details is a complex type in the template “tmpl-order”. If the Order Details element existed in the schema, depending on what view you are in, it would look like the following:

 

    

<xs:element name="ORDER_DETAILS">
  <xs:complexType>
   <xs:sequence>
    <xs:element name="CUSTOMER_NAME" type="xs:string"/>
    <xs:element name="NO_OR_BUILDING_NAME" type="xs:string"/>
    <xs:element name="STREET" type ="xs:string"/>
    <xs:element name="TOWN" type="xs:string"/>
    <xs:element name="POST_CODE" type="xs:string"/>
    <xs:element name="ORDER_DATE" type="xs:date"/>
    <xs:element name="ORDER_TYPE" type="xs:string"/>
   </xs:sequence>
  </xs:complexType>
</xs:element>

    

What is a repeating element?

This is a complex type that can exist more than once in a module while only being defined once. It is typically used to represent a list or a table of data with several rows. They are always defined inside of a list element, usually having the same name but with the suffix “list”. For example, Order Item List is a complex type list which contains the repeating element Order Item (this is also a complex type) in the template “tmpl-order”. If the Order Item List element existed in the schema, depending on what view you are in, it would look like the following:

 

<xs:element name="ORDER_ITEM_LIST">
  <xs:complexType>
   <xs:sequence>
    <xs:element name="ORDER_ITEM" minOccurs="0" maxOccurs ="unbounded">
     <xs:complexType>
      <xs:sequence>
       <xs:element name="ORDER_NO" type="xs:integer"/>
       <xs:element name="QTY" type="xs:integer"/>
       <xs:element name="PART_NO" type="xs:string"/>
       <xs:element name="DESC" type="xs:string"/>
       <xs:element name="UNIT_PRICE" type="xs:decimal"/>
       <xs:element name="PRICE" type="xs:decimal"/>
      </xs:sequence>
     </xs:complexType>
    </xs:element>
   </xs:sequence>
  </xs:complexType>
</xs:element>

         

EXERCISES

Exercise 1

In your XX_ORDERMODULE template list, identify: