A method and system are provided for converting a hierarchical data structure
into
a flat data structure based on a schema. The format of the hierarchical data structure
may be XML. A hierarchical data structure conforming to a schema is loaded into
an application program. The data structure includes elements and attributes linked
together in a parent-child relationship. The schema defines the hierarchical relationships
between the elements and attributes in the hierarchical data structure. After the
hierarchical data structure conforming to the schema has been loaded, a plurality
of layout rules is applied to the hierarchical data based on the schema to create
a flat data structure. The layout rules determine how the hierarchical data will
be inserted in the flat data structure. The layout rules may be applied by identifying
properties in the schema which identify occurrence requirements for elements defined
in the schema. After the layout rules have been applied to the hierarchical data,
the hierarchical data is rendered into a spreadsheet by inserting the data in rows
and columns.