Skip to content

XmlTemplate

XmlTemplate

Syntax

<XmlTemplate rootSectionName="...">
  <FileFormat/>
  <Output ... />
  <XmlSections>
    <XmlSection ... />
  </XmlSections>
  <TemplateAttributeInjections>
    <TemplateAttributeInjection ... />
  </TemplateAttributeInjections>
  <TemplatePlaceholderInjections>
    <TemplatePlaceholderInjection ... />
  </TemplatePlaceholderInjections>
  <TemplateNodeRemovals>
    <TemplateNodeRemoval ... />
  </TemplateNodeRemovals>
  <TextTemplates>
    <TextTemplate ... />
  </TextTemplates>
</XmlTemplate>

Parameters

Parameter Description Default Remark
rootSectionName1 The name of the root section. _template_

Child sections

Section Description
FileFormat2 See FileFormat
Output2 See Output
XmlSection See XmlSection
TemplateAttributeInjection See TemplateAttributeInjection
TemplatePlaceholderInjection See TemplatePlaceholderInjection
TemplateNodeRemoval See TemplateNodeRemoval
TextTemplate See TextTemplate

FileFormat

Syntax

<FileFormat
  ...
  commentNodeXPath="..."
/>

Parameters

Parameter Description Default Remark
... Click here to see the generic FileFormat options.
commentNodeXPath1 The template comment node XPath, this will be executed on the template and the resulting elements or attributes are inspected for annotations.
The commentNodeXPath expression must be specified relative to the node for which the annotation applies. So for example when the description attribute of an element may contain the annotation the XPath must be '@description'.
See XPath.

XmlSection

The XmlSection configuration defines a section in a XML template. This can either be defined in the template part of the config or in the template directly. The syntax here is provided for the configuration, but the same parameters are also available when specifying the section inline in a template using the XmlSection annotation.

Syntax

<XmlSection
  name="..."
  templateXPath="..."
/>

Parameters

Parameter Description Default Remark
name1 The name of the section. This can only contain a-z, A-Z, 0-9, _ and - characters.
templateXPath1 The XPath which needs to be executed on the template document to get the element which resembles the section element. See XPath.

TemplateAttributeInjection

Syntax

<TemplateAttributeInjection
  templateXPath="..."
  attributeName="..."
  attributeValue="..."
/>

Parameters

Parameter Description Default Remark
templateXPath1 The XPath for template node where attribute needs to be injected. See XPath.
attributeName1 The name of the attribute to inject. If the attribute is already present in the template it's value will be overwritten
attributeValue Default value for the newly injected attribute.

TemplatePlaceholderInjection

Syntax

<TemplatePlaceholderInjection
  templateXPath="..."
  modelNode="..."
  scope="..."
/>

Parameters

Parameter Description Default Remark
templateXPath1 The XPath to evaluate on the template document to find the node on which to inject the placeholder. See XPath.
modelNode1 What node in the model needs to be selected in the placeholder (it will be the right side of the placeholder).
scope The template placeholder scope. This is either current or child. current

TemplateNodeRemoval

The TemplateNodeRemoval configuration can be used to remove parts of an XML template during generation. This step is performed before all other modifications on the XML template (like attribute and placeholder injection).

Syntax

<TemplateNodeRemoval
  templateXPath="..."
/>

Parameters

Parameter Description Default Remark
templateXPath1 The XPath to apply on the template to get to the element or attribute which needs to be removed. When the XPath resolves to multiple elements or attributes, all will be removed. See XPath.

TextTemplate

A XML template can contain elements or attribute which in itself contain a text template. For example when a ETL package (which is a XML template) contains a SQL SELECT statement to fetch data from a source system. To instruct CrossGenerate to interpret the element or attribute as a text template, the TextTemplate element can be specified in the configuration of a XML template.

Syntax

<TextTemplate
  node="..."
  rootSectionName="..."
>
  <FileFormat ... />
  <TextSections>
    <TextSection ... />
  </TextSections>
</TextTemplate>

Parameters

Parameter Description Default Remark
node1 The node which contains the text template
rootSectionName The name of the root section.

Child sections

Section Description
FileFormat2 See FileFormat
TextSection See TextSection

  1. required parameter 

  2. required child section