Skip to content

XmlTemplate

XmlTemplate

Syntax

<XmlTemplate rootSectionName="...">
  <FileFormat/>
  <Output ... />
  <XmlSections>
    <XmlSection ... />
  </XmlSections>
  <TemplateAttributeInjections>
    <TemplateAttributeInjection ... />
  </TemplateAttributeInjections>
  <TemplatePlaceholderInjections>
    <TemplatePlaceholderInjection ... />
  </TemplatePlaceholderInjections>
  <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
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. This is only relevant for xml templates.

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.

TemplateAttributeInjection

Syntax

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

Parameters

Parameter Description Default Remark
templateXPath1 The XPath for template node where attribute needs to be injected.
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.
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

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