HTML Mask (HtmlMaskGenerator)

The HTML Mask generator masks text columns by parsing the contents as HTML, and applying sub-generators to specified path expressions.

If applying a sub-generator fails because of an error, the generator selected as the fallback generator is applied instead.

For the HTML Mask generator, there is a link object for each XPath expression value to assign a generator to.

The generator does not itself support consistency or differential privacy.

The metadata object is populated from the HtmlMaskMetadata object. It includes:

  • pathExpression, which is the XPath expression that identifies the value to apply the sub-generator to.

  • The subGeneratorMetadata object, which identifies and configures the sub-generator.

{
  "schema": "string",
  "table": "string",
  "column": "string",
  "metadata": {
    "generatorId": "HtmlMaskGenerator",
    "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
    }
  }
}

Example replacement

In the following example replacement for the HTML Mask generator:

  • The Character Scramble generator is assigned to the value of the XPath expression //p. Consistency is disabled.

  • The Company Name generator is assigned to the value of the XPath expression //p/@data. Consistency is disabled.

  • In the case of an error applying either of those generators, the fallback generator is the Constant generator, which sets the value to 10.

{
  "name": "html_data",
  "schema": "public",
  "table": "html_me",
  "links": [
    {
      "schema": "public",
      "table": "html_me",
      "column": "html_data",
      "metadata": {
        "generatorId": "HtmlMaskGenerator",
        "presetId": "HtmlMaskGenerator",
        "pathExpression": "//p",
        "subGeneratorMetadata": {
          "presetId": "TextMaskGenerator",
          "generatorId": "TextMaskGenerator",
          "isConsistent": false
        }
      }
    },
    {,
      "schema": "public",
      "table": "html_me",
      "column": "html_data",
      "metadata": {
        "generatorId": "HtmlMaskGenerator",
        "presetId": "HtmlMaskGenerator",
        "pathExpression": "//p/@data",
        "subGeneratorMetadata": {
          "presetId": "CompanyNameGenerator",
          "generatorId": "CompanyNameGenerator",
          "isConsistent": false
        }
      }
    }
  ],
  "fallbackLinks": [
    {
      "schema": "public",
      "table": "html_me",
      "column": "html_data",
      "metadata": {
        "presetId": "string",
        "generatorId": "ConstantGenerator",
        "constant": "10"
      }
    }
  ]
}

Last updated