Skip to main content

DomOperation

A single DOM extraction or deletion operation for the DomTransformer.

Notes

Defines a single DOM extraction or deletion operation for the DomTransformer. Specifies a CSS/jQuery-style selector, the element attribute or content to extract, the target metadata field, and optional behavior for blank values and default values when no match is found.

Usage

defaultValue: string
delete: false
extract: string
matchBlanks: false
onSet: APPEND
selector: string
toField: string

Properties

PropertyTypeRequiredDefault
defaultValuestringNo-
deletebooleanNofalse
extractstringNo-
matchBlanksbooleanNofalse
onSetenumNo-
selectorstringNo-
toFieldstringNo-

Property Details

defaultValue

Value stored in toField when the selector matches nothing. Without it, no field is created for documents where the selector finds nothing. Not applicable when delete is true.

delete

Whether to delete the matching elements from the document instead of extracting them. Default is false. When true, toField, defaultValue and extract do not apply — the operation removes markup rather than reading it.

extract

Specifies what to extract from the matched DOM element (e.g., text, html, outerHtml, ownText, data, id, tagName, val, className, cssSelector, or attr(attributeKey)).

matchBlanks

Whether an element with a blank value counts as a match, storing an empty string. Default is false, which treats blank elements as no match at all.

onSet

Defines what to do when the target field already has one or more values. When unspecified, new values are appended to existing ones by default.

Allowed Values

  • APPEND
  • PREPEND
  • REPLACE
  • OPTIONAL

selector

A CSS or jQuery-like selector expression identifying which DOM elements to target.

toField

The target metadata field name where the extracted or computed value will be stored. If a field of the same name already exists, the behavior is controlled by onSet.