> For the complete documentation index, see [llms.txt](https://docs.tonic.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tonic.ai/app/generation/generators/generator-reference/xml-mask.md).

# XML Mask

This is a [composite generator](/app/generation/generators/generator-types/generators-composite.md).

Runs a selected generator on values that match a user specified path expression.

Path expressions are defined using the [XPath syntax](https://www.w3schools.com/xml/xpath_syntax.asp).

For example, for the following XML content:

```xml
<?xml version="1.0" encoding="UTF-8"?>
    <household>
        <member>
            <first_name>John</first_name>
            <last_name>Smith</last_name>
            <age>25</age>
            <occupation>Teacher</occupation>
            <salary>45000</salary>
        </member>
    </household>
</xml>
```

To get the `first_name` value, you would use `/household/member/first_name`.

You can also select a fallback generator to run on the entire XML value if there is any error during data generation.

## Characteristics <a href="#xml-mask-characteristics" id="xml-mask-characteristics"></a>

<table data-header-hidden><thead><tr><th valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top"><strong>Consistency</strong></td><td valign="top">Determined by the selected sub-generators.</td></tr><tr><td valign="top"><strong>Linking</strong></td><td valign="top">Determined by the selected sub-generators.</td></tr><tr><td valign="top"><strong>Differential privacy</strong></td><td valign="top">Determined by the selected sub-generators.</td></tr><tr><td valign="top"><strong>Data-free</strong></td><td valign="top">Determined by the selected sub-generators.</td></tr><tr><td valign="top"><strong>Allowed for primary keys</strong></td><td valign="top">No</td></tr><tr><td valign="top"><strong>Allowed for unique columns</strong></td><td valign="top">No</td></tr><tr><td valign="top"><strong>Uses format-preserving encryption (FPE)</strong></td><td valign="top">No</td></tr><tr><td valign="top"><strong>Privacy ranking</strong></td><td valign="top">5</td></tr><tr><td valign="top"><strong>Generator ID (for the API)</strong></td><td valign="top"><a href="/pages/dIttKiW7ByeVYtoSkosK"><code>XmlMaskGenerator</code></a></td></tr></tbody></table>

## How to configure <a href="#xml-mask-configure" id="xml-mask-configure"></a>

### Adding a sub-generator <a href="#xml-mask-add-sub-generator" id="xml-mask-add-sub-generator"></a>

To assign a generator to a path expression:

1. Under **Sub-generators**, click **Add Generator**.\
   \
   On the sub-generator configuration panel, the **Cell XML** field contains a sample value from the source database. You can use the previous and next icons to page through different values.
2. In the **Path Expression** field, type the path expression to identify the value to apply the generator to.\
   \
   **Matched XML Values** shows the result from the value in **Cell XML**.
3. From the **Generator Configuration** dropdown list, select the generator to apply to the value at the path expression.\
   \
   You cannot select another composite generator.
4. Configure the selected generator.\
   \
   You cannot configure the selected generator to be consistent with another column.
5. To save the configuration and immediately add a generator for another path expression, click **Save and Add Another**.\
   \
   To save the configuration and close the add generator panel, click **Save**.

### Managing the sub-generators list <a href="#xml-mask-manage-sub-generators" id="xml-mask-manage-sub-generators"></a>

From the **Sub-Generators** list:

* To edit a generator assignment, click the edit icon.
* To remove a generator assignment, click the delete icon.
* To move a generator assignment up or down in the list, click the up or down arrow.

### Selecting a fallback generator <a href="#xml-mask-fallback-generator" id="xml-mask-fallback-generator"></a>

From the **Fallback Generator** dropdown list, select the generator to use if any error occurs in the generation.

The fallback generator is then used for the entire XML value.

The options are:

* [Passthrough](/app/generation/generators/generator-reference/passthrough.md)
* [Constant](/app/generation/generators/generator-reference/constant.md)
* [Null](/app/generation/generators/generator-reference/null.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.tonic.ai/app/generation/generators/generator-reference/xml-mask.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
