Use of <ref> to refer a nested composite type.
My question is, referring to SBE 2.x, if is possible to use the <ref> tag to link to a composite type that was just defined as a nested composite.
I try to explain it with an example.
Imagine that I have this:
<composite name="longPrice">
<type name="mantissa" primitiveType="int64" />
<type name="exponent" primitiveType="int8" />
<composite name="priceType">
<type name="internalPriceCode" primitiveType="char" length="3"/>
<enum name="enumPriceCode" encodingType="uint8">
<validValue name="USD">0</validValue>
<validValue name="EUR">1</validValue>
</enum>
</composite>
</composite>
<composite name="shortPrice">
<type name="mantissa" primitiveType="int32" />
<type name="exponent" primitiveType="int8" />
<ref name="priceTypeRef" type="priceType" offset="5" />
</composite>
Technically the XSD of version 2.x allows this. So is this correct? Could I use a <ref> tag in this way where the composite "priceType" is referred despite is nested definition?
I think that however is desiderable and maybe better to have this solution, right?:
<composite name="priceType">
<type name="internalPriceCode" primitiveType="char" length="3"/>
<enum name="enumPriceCode" encodingType="uint8">
<validValue name="USD">0</validValue>
<validValue name="EUR">1</validValue>
</enum>
</composite>
<composite name="longPrice">
<type name="mantissa" primitiveType="int64" />
<type name="exponent" primitiveType="int8" />
<ref name="priceTypeRef" type="priceType" offset="9" />
</composite>
<composite name="shortPrice">
<type name="mantissa" primitiveType="int32" />
<type name="exponent" primitiveType="int8" />
<ref name="priceTypeRef" type="priceType" offset="5" />
</composite>
The specification says that the type attribute of <ref> ...
Must match a defined type, enum or set or composite name attribute.
It seems to me that your second example is in line with the intent of the specification.
Ok. Could be useful, I think, to refer a nested composite using "." to concatenate the nested composite. In this way I can write longPrice.priceTypeRef For example, referring to my first example I could write:
<ref name="longPrice.priceTypeRef" type="priceType" offset="5" />
This could be an idea to avoid ambiguous interpretation, even if I prefer my second example above where there is not a referring to a nested composite.