# tWriteXMLField

Reads an input XML file and extracts the structure to insert it in defined fields of the output XML file.

## tWriteXMLField Standard properties

These properties are used to configure tWriteXMLField running in the Standard Job framework.

The Standard tWriteXMLField component belongs to the XML family.

The component in this framework is available in all Talend products.

## Basic settings

| Properties | Description |
| --- | --- |
| Output Column | Select the destination field in the output<br>component where you want to write the XML structure. |
| Configure XML Tree | Opens the interface that supports the<br>creation of the XML structure you want to write in a field. For more<br>information about the interface, see [Defining the XML tree](https://help.qlik.com/talend/en-US/components/8.0/xml-connectors/defining-xml-tree). |
| Schema and Edit Schema | <ul> <li> <p>A schema is a row description, it defines                            the number of fields that will be processed and passed on to the next                            component. The schema is either built-in or remote in the Repository. </p> <p>Click <span>Edit        schema</span> to make changes to the schema. If the current schema is of the <span>Repository</span> type, three options are available:</p> <ul> <li> <p> <span>View schema</span>: choose this                option to view the schema only.</p> </li> <li> <p> <span>Change to built-in property</span>:                choose this option to change the schema to <span>Built-in</span> for local changes.</p> </li> <li> <p> <span>Update repository connection</span>:                choose this option to change the schema stored in the repository and decide whether                to propagate the changes to all the Jobs upon completion.</p> <p>If you just want to                propagate the changes to the current Job, you can select <span>No</span> upon completion and choose this schema metadata                again in the <span>Repository Content</span>                window.</p> </li> </ul> </li> <li> <p> <span>Built-in</span>: You create the schema and                            store it locally for this component only. For more information about a component schema in its <span>Basic settings</span> tab, see <a href="https://help.qlik.com/talend/r/en-US/8.0/studio-user-guide/basic-settings-tab" target="_blank">Basic settings tab</a>.</p> </li> <li> <p> <span>Repository</span>: You already created the                            schema and stored it in the Repository, hence can be reused in various                            projects and Job flowcharts. For more information about a component schema in its <span>Basic settings</span> tab, see <a href="https://help.qlik.com/talend/r/en-US/8.0/studio-user-guide/basic-settings-tab" target="_blank">Basic settings tab</a>.</p> </li> </ul> |
| Sync columns | Click to synchronize the output file<br>schema with the input file schema. The Sync function only displays once<br>the Row connection is linked with the input component. |
| Group by | Define the aggregation set, the columns<br>you want to use to regroup the data. |

## Advanced settings

| Properties | Description |
| --- | --- |
| Remove the XML declaration | Select this check box if you do not want<br>to include the XML header. |
| Create empty element if needed | This check box is selected by default. If<br>the Related<br>Column in the XML tree editor has null values, or if no<br>column is associated with the XML node, this option creates an<br>open/close tag in the expected place. |
| Ignore service attributes<br>for empty elements | Select this option to prevent the component from<br>generating an XML node if the input node is null but has service<br>attributes (such as @type, @class, and @array).<br><br>This option is available when the Create empty element if needed option<br>is not selected. |
| Expand Empty Element if needed(for<br>dom4j) | Select this option to allow a null<br>element to appear in the form of tag pair, e.g.<br>&lt;element&gt;&lt;/element&gt;. Otherwise, such an element appears as a<br>solo tag, e.g. &lt;element/&gt;. For more information about XML tags,<br>see http://www.tizag.com/xmlTutorial/xmltag.php.<br><br>Information noteNote: To use this option, you must select<br>the Dom4J<br>generation mode. Available when Create empty element if needed is<br>selected. |
| Create associated XSD file | If one of the XML elements is defined as<br>a Namespace element, this option will create the corresponding XSD file.<br><br>Information noteNote: To use this option, you must select<br>the Dom4J<br>generation mode. |
| Advanced separator (for number) | Select this check box if you want to<br>modify the separators used by default for numbers.<br><br><br>Thousands separator: enter between<br>brackets the separators to use for thousands.<br><br><br>Decimal separator: enter between<br>brackets the separators to use for decimals. |
| Generation mode | Select the appropriate generation mode<br>according to your memory availability. The available modes are:<br><br><ul> <li> <span>Slow and memory-consuming                                    (Dom4j)</span> <div><span>Information note</span><span>Note:</span> This                                    option allows you to use dom4j to process the XML files of high                                    complexity. </div> </li> <li> <span>Fast with low memory                                consumption</span> </li> </ul> |
| Encoding | Select the encoding type in the list or<br>select Custom<br>and define it manually. This field is compulsory when working with<br>databases. |
| tStatCatcher Statistics | Select this check box to gather the Job<br>processing metadata at a Job level as well as at each component<br>level. |

## Global Variables

| Variables | Description |
| --- | --- |
| Global Variables | ERROR\_MESSAGE: the error message generated by the<br>component when an error occurs. This is an After variable and it returns a string. This<br>variable functions only if the Die on error checkbox is<br>cleared, if the component has this checkbox.<br><br><br>NB\_LINE: the number<br>of rows read by an input component or transferred to an output component. This is an<br>After variable and it returns an integer.<br><br>A Flow variable functions during the execution of a component<br>while an After variable functions after the execution of the component.<br><br>To fill up a field or expression with a variable, press Ctrl+Space to access the variable list and choose the variable to use from<br>it.<br><br>For more information about variables, see [Using contexts and variables](https://help.qlik.com/talend/r/en-US/8.0/studio-user-guide/contexts-and-variables). |

## Usage

| Usage guidance | Description |
| --- | --- |
| **Usage rule** | This component can be used as<br>intermediate step in a data flow. |

**Related concepts**

* [Extracting the structure of an XML file and inserting it into the fields of a database table](https://help.qlik.com/talend/en-US/components/8.0/xml/twritexmlfield-tfileinputxml-tmysqloutput-tmysqloutput-extracting-structure-of-xml-file-and-inserting-it-into-fields-of-database-table-standard-component "This three-component scenario allows to read an XML file, extract the XML structure, and finally outputs the structure to the fields of a database table.")