Skip to content

Use of <ref> to refer a nested composite type. #123

Open
@cardefusco

Description

@cardefusco

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>	

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions