Composition
Composition fills an aggregation
A composition fills an aggregation with concrete child Block instances on a Block definition — nested inside the aggregation member it fills, never standalone.
One container concept, two forms
Composition is the initial fill of an aggregation on a Block definition only; bml:container is the general virtual container used everywhere else, on Block instances — both support the same flow-control directives.
Composition nests recursively
Every Block instance inside a composition may itself contain aggregation members, opened directly by name just like any other instance — complex nested structures build up this way without ever needing a nested composition wrapper.
Filling an aggregation with one child
An aggregation on a Block definition can declare an initial fill, nesting its composition directly inside the aggregation member.
<!-- composition sits nested inside "items", never standalone -->
<acme:Basket xmlns="http://blockml.org/bml"
xmlns:acme="com.acme.example"
xmlns:core="org.blockml.bml.core">
<baseType>
core:Block
</baseType>
<aggregations>
<items type="acme:Widget">
<composition>
<acme:Widget bml:id="firstWidget" />
</composition>
</items>
</aggregations>
</acme:Basket>
The composition holding firstWidget only makes sense as the fill of the items aggregation it sits inside — the same element written outside any aggregation member would be a standalone composition and invalid.
What to carry into the next pages
After this page, readers should be able to fill an aggregation with the correct composition syntax, before Sub-Blocks introduces nested Block definitions that composition children may also be typed by.