# XML Mask (XmlMaskGenerator)

The [XML Mask](https://docs.tonic.ai/app/generation/generators/generator-reference/xml-mask) generator runs a selected generator on values that match a user specified path expression.

## Link object structure <a href="#generator-api-xml-mask-link-object" id="generator-api-xml-mask-link-object"></a>

For the XML Mask generator, there is a link object for each path expression value to assign a sub-generator to.

The generator does not itself support consistency or differential privacy.

The `metadata` object is populated from the [`XmlMaskMetadata`](https://app.tonic.ai/apidocs/index.html#/models/XmlMaskMetadata) object. It includes:

* `pathExpression`, which is the expression that identifies the value to apply the sub-generator to.
* The `subGeneratorMetadata` object, which identifies and configures the sub-generator.

{% code overflow="wrap" %}

```json
{
  "schema": "string",
  "table": "string",
  "column": "string",
  "dataType": "string",  //MongoDB only
  "metadata": {
    "generatorId": "XmlMaskGenerator",
    "customValueProcessor": "string",  //If custom value processor applied
    "pathExpression": "string",
    "subGeneratorMetadata": {
      "presetId": "string",
      "generatorId": "string",
      //Metadata for the selected sub-generator
      "customValueProcessor": "string"  //If custom value processor applied to the sub-generator
    }
  }
}
```

{% endcode %}

## Example replacement <a href="#generator-api-xml-mask-replacement" id="generator-api-xml-mask-replacement"></a>

In the following example replacement for the XML Mask generator:

* The Name generator is assigned to the path expression `//view/item-descriptor//@display-name`. The value is in the format First Name Last Name (John Smith), and capitalization is not preserved. Consistency is disabled.
* The Constant generator is assigned to the path expression `//view//object-class`. The constant value is `object-class`.

```json
{
  "name": "xml_data",
  "schema": "public",
  "table": "xml_me",
  "links": [
    {
      "schema": "public",
      "table": "xml_me",
      "column": "xml_data",
      "metadata": {
        "generatorId": "XmlMaskGenerator",
        "presetId": "XmlMaskGenerator",
        "pathExpression": "//view/item-descriptor//@display-name",
        "subGeneratorMetadata": {
          "presetId": "NameGenerator",
          "generatorId": "NameGenerator",
          "nameType": "FirstThenLastName",
          "preserveCapitalization": false,
          "isConsistent": false
        }
      }
    },
    {
      "schema": "public",
      "table": "xml_me",
      "column": "xml_data",
      "metadata": {
        "generatorId": "XmlMaskGenerator",
        "presetId": "XmlMaskGenerator",
        "pathExpression": "//view//object-class",
        "subGeneratorMetadata": {
          "presetId": "ConstantGenerator",
          "generatorId": "ConstantGenerator",
          "constant": "object-class"
        }
      }
    }
  ]
}
```


---

# Agent Instructions: 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:

```
GET https://docs.tonic.ai/app/api/quick-start-guide/tonic-api-generator-assignment/generator-api-reference/generator-api-ref-xml-mask.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
