Engineering note
Preserving message semantics during transformation
Typed XML models, ordered geometry and round-trip verification.
Message processing / Serialisation
Deserialisation and field preservation
The documented WinTAK rectangle issue involved an XML value represented as an attribute where the application model expected element text. Deserialisation failed and the message entered quarantine. Correcting that mapping resolved the exception, but other unmodelled geometry and presentation fields were still lost during serialisation.
A successful parse therefore established only part of the required behaviour. The resulting message also needed to retain permitted attributes, vertex order and provenance through transformation.
Explicit schema coverage
The recorded solution introduced typed models for the attribute-based values, ordered geometry and creator metadata. Validation checked applicable values, while sanitisation profiles controlled the permitted fields. Newly modelled fields were subject to explicit policy rather than unrestricted XML passthrough.
This introduces a maintenance requirement: extensions require model and policy updates before they can be supported. Unknown content must have a defined outcome instead of being silently lost or forwarded without evaluation.
Semantic verification path
- DecodeMap XML elements and attributes into typed values.
- ValidateCheck required structure and valid numeric values.
- Apply policyRemove only fields excluded by the selected output policy.
- Encode and compareDecode the serialised result and compare its permitted meaning.
Independent XML fixture
The following example uses a fictional local-coordinate shape. It is deliberately separate from CoT and contains no operational coordinates or project payloads.
<shape units="local">
<vertex x="1" y="1"/><vertex x="4" y="1"/>
<vertex x="4" y="3"/><vertex x="1" y="3"/>
<creator display="Example" internalId="private-example"/>
</shape>
The typed model contains four ordered vertices and two creator fields. Its example output policy removes internalId, preserving the display value and all vertices. The source model remains unchanged, allowing separate destinations to be prepared independently.
Executed assertions
The accompanying Python fixture uses immutable typed values and standard-library XML serialisation. Four executable tests verify:
- Decode, encode and decode preserve every modelled value and vertex order.
- Output preparation removes the internal identifier while retaining geometry and display metadata.
- An unmodelled extension is rejected by the example schema.
- A non-finite coordinate is rejected before construction of the typed value.
python3 verify_example.py
Download the Python fixture and its four tests. The tests passed locally. This fixture demonstrates transformation assertions; production XML processing requires separate input-size, parser-security and schema controls.
Verification scope
Round-trip equality without a policy establishes preservation. Once a policy intentionally removes fields, compare against the expected permitted representation rather than the original input. A separate interoperability test remains necessary to establish that the receiving system interprets the output correctly.
Related reading: sanitisation boundaries, stream framing and the networking case study.
Examples are generalised or synthetic and omit operational details and identifying information.
← All engineering notes