Optional Substitutions

Another feature of BinXml templates is that substitutions can be specified such that the enclosing element or attribute MUST be omitted from rendered XML text (or other processing) if the value identified by the substitution is NULL in the Template Instance data. If this type of rendering from the BinXml is wanted, the substitution needs to be specified by using an optional substitution token. The optional substitution token is 0x0E, as compared to the normal substitution token 0x0D.

The server MAY determine whether to use the optional substitution token based on the event definition.<7>

The following table contains an example where %1 and %2 represent the optional substitution tokens.





01 SomeEvent 02

<PropA> %1 </PropA>

01 PropA 02 05 0E 00 04

<PropB> %2 </PropB>

01 PropB 02 05 0E 01 04


04 00

02 00 00 01 04

65 00

This tells any processor of the encoded BinXml to use the following XML representation.

 <PropB> 101 </PropB>   

Note The preceding Value Spec for the optional element PropA specifies that the substitution value is NULL (see Type System (section, and this is how the BinXml processor knows to omit this element.

The optional substitution applies only to the element or attribute immediately enclosing it.

Note If an element contains an optional substitution, and that substitution value is NULL, the element cannot appear in rendered XML, even if that element has attributes containing content, other (nonNULL) substitution values, and so on.