A package may include one or more products, or none. Each product can have one or more options, or none. Each package, product or option may have a price.
First option, nested hierarchical (using square brackets):
[order]
[package]
[packageID/]
[price/]
[product]
[productID/]
[price/]
[/product]
[product]
[option]
[optionID/]
[price/]
[/option]
[option]
[optionID/]
[price/]
[/option]
[/product]
[/package]
[/order]
Second option, flattened with cross-references:
[order]
[package]
[packageID/]
[price/]
[/package]
[product]
[productID/]
[packageID/]
[price/]
[/product]
[product]
[productID/]
[packageID/]
[optionID/]
[price/]
[/product]
[product]
[productID/]
[packageID/]
[optionID/]
[price/]
[/product]
[/order]
First option advantages:
* Logical, intuitive structure
* Simple to transform with XSL
* Easy to grab metadata -- like "count(products)"
Second option advantages:
* Easy to generate from DB
* Easy to loop through with procedural languages
* Known maximum depth of nesting
I've got my preference. Anybody got some good arguments one way or the other (or links to them)?