Using Code Templates
template
The
templatenode registers a template that can be used to avoid duplicate code when extending the generated code, and it is a child of the typesystem node.<typesystem> <template name="my_template"> // the code </template> </typesystem>Use the
insert-templatenode to insert the template code (identified by the template’snameattribute) into the generated code base.
insert-template
The
insert-templatenode includes the code template identified by the name attribute, and it can be a child of the inject-code, conversion-rule, template,custom-constructororcustom-destructornodes.<inject-code class="target" position="beginning"> <insert-template name="my_template" /> </inject-code>Use the
replacenode to modify the template code.
replace
The
replacenode allows you to modify template code before inserting it into the generated code, and it can be a child of the insert-template node.<insert-template name="my_template"> <replace from="..." to="..." /> </insert-template>This node will replace the attribute
fromwith the value pointed byto.

