--- title: "VelocityTemplateParserUnit" slug: "velocity-template-parser-unit" updated: 2026-08-18T08:59:19Z published: 2026-08-18T08:59:19Z canonical: "docs.lobstersoftware.com/velocity-template-parser-unit" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.lobstersoftware.com/llms.txt > Use this file to discover all available pages before exploring further. # VelocityTemplateParserUnit | **Class name** | com.ebd.hub.datawizard.iu.VelocityTemplateParserUnit | | --- | --- | This Integration Unit can be used to create a text file via a velocity template file. An XML file is generated internally from the Target tree. This XML file (passed with the prefix "xmlRoot", see example) is processed by the Velocity template file to generate the final text file. This text file can then be used in the Response as the output of the Integration Unit. ## Parameters | Parameter | Allowed values | Default value | Description | | --- | --- | --- | --- | | create root element 'VelocityRoot' | true, false | false | If no valid root element is created (e.g. due to several top-level nodes), this parameter must be set to *true*. This creates a top-level element *VelocityRoot* in the XML file. | | template-file | | | Path to template file with Velocity instructions. **Example:** *./conf/sample.vm* | | use Velocity XmlTool | true, false | false | If *true*, the variable *useXmlTool* is set to *true* (see example). This variable can be used to access the internally generated XML with the Apache Velocity XmlTool (Version 3.1) (see example). This simplifies the Velocity statements. If the XmlTool is not used, normal Java DOM instructions must be used (see example). | | write created XML to log | true, false | false | The generated XML file is written into the log. **IMPORTANT:** This only works in a real Profile run and not in a Mapping test. | ## Example In the following example, the profile reads the source data (*input.xml*) into the source structure. Via 1:1 mapping, these are transferred to the target structure. The internal XML file is generated from the target tree (i.e. the target structure filled with data). Please note that the source data does not have to be in XML format. The internal XML file is always created from the target tree. The Integration Unit then uses the internal XML file and the Velocity template to generate the final text file, which is then used in the response. Note that the internal XML file is addressed in the Velocity template with the prefix *xmlRoot*. Run the profile with the values *true* and *false* for the Integration Unit parameter *use Velocity XmlTool*. In the job log you will find the internally generated XML file. Profile: [Profile-Test_Velocity_Unit.pak](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/Profile-Test_Velocity_Unit.pak) Profile source data: [input.xml](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/input.xml) Velocity template file: [sample.vm](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/sample.vm) ```sample ## This is a comment (two #). ## The next line defines a macro that only works WITHOUT XmlTools. The macro outputs the XML with DOM. #macro ( recursive $e $indent )        #if( $e.getChildren().size() > 0 )        $indent <$e.getName()>        #foreach ($child in $e.getChildren() )            #recursive( $child "$indent  " )        #end        $indent    #else        $indent <$e.getName()>        $indent    $e.getTextTrim()        $indent    #end #end #set($i = " ") ## The variable is set by the Integration Unit parameter "useXmlTool". #if($useXmlTool) With XmlTool, access by simplified 'XPath': body : $xmlRoot.body.text ## "name" and "last" are functions of XmlTool, therefore the pure .dot notation does not work here. last name: $xmlRoot.find('/document/properties/author/name/last/full').text email:  $xmlRoot.properties.author.email.text ## Without XmlTool. #else First, we print out the document tree with a recursive Velocimacro : #recursive( $xmlRoot.getRootElement() $i ) Next, we access pieces of data directly : email : $xmlRoot.getRootElement().getChild("properties").getChild("author").getChild("email").getText() last name :  $xmlRoot.getRootElement().getChild("properties").getChild("author").getChild("name").getChild("last").getChild("full").getText() #end ``` XML (Extensible Markup Language) is a structured text format for storing and exchanging data. Content is enclosed within freely definable tags such as `<order>`. XML is human-readable, machine-processable, and platform-independent. In the Lobster Data Platform, you can receive, parse, and generate XML data. Structured representation of the input data in Phase 3. The target tree receives the values transferred via mapping and passes them on to Phase 4, Phase 5, or Phase 6. The response determines how a profile sends processed data. In Phase 6, a response determines how and where the output data is sent or stored, e.g., via FTP, HTTP or e-mail. A profile can use several responses in parallel. A profile is the central configuration unit in the Lobster Data Platform. It receives data, processes it, and forwards it. Configuration is done graphically, with no programming required. The core task of Phase 3. Mapping transfers data from the source structure to the target structure according to defined rules. In the process, fields can be transformed, functions can be called, and values can be calculated.