PutHTMLElement

Description:

Places a new HTML element in the existing HTML DOM. The desired position for the new HTML element is specified by using CSS selector syntax. The incoming HTML is first converted into a HTML Document Object Model so that HTML DOM location may be located in a similar manner that CSS selectors are used to apply styles to HTML. The resulting HTML DOM is then "queried" using the user defined CSS selector string to find the position where the user desires to add the new HTML element. Once the new HTML element is added to the DOM it is rendered to HTML and the result replaces the flowfile content with the updated HTML. A more thorough reference for the CSS selector syntax can be found at "http://jsoup.org/apidocs/org/jsoup/select/Selector.html"

Tags:

put, html, dom, css, element

Properties:

In the list below, the names of required properties appear in bold. Any other properties (not in bold) are considered optional. The table also indicates any default values, and whether a property supports the NiFi Expression Language.

Display NameAPI NameDefault ValueAllowable ValuesDescription
CSS SelectorCSS SelectorCSS selector syntax string used to extract the desired HTML element(s).
Supports Expression Language: true (will be evaluated using flow file attributes and variable registry)
HTML Character EncodingHTML Character EncodingUTF-8Character encoding of the input HTML
Element Insert Location TypeElement Insert Location Typeappend-html
  • append-html
  • prepend-html
Controls whether the new element is prepended or appended to the children of the Element located by the CSS selector. EX: prepended value '<b>Hi</b>' inside of Element (using CSS Selector 'p') '<p>There</p>' would result in '<p><b>Hi</b>There</p>'. Appending the value would result in '<p>There<b>Hi</b></p>'
Put ValuePut ValueValue used when creating the new Element. Value should be a valid HTML element. The text should be supplied unencoded: characters like '<', '>', etc will be properly HTML encoded in the resulting output.
Supports Expression Language: true (will be evaluated using flow file attributes and variable registry)

Relationships:

NameDescription
element not foundElement could not be found in the HTML document. The original HTML input will remain in the FlowFile content unchanged. Relationship 'original' will not be invoked in this scenario.
successSuccessfully parsed HTML element
originalThe original HTML input
invalid htmlThe input HTML syntax is invalid

Reads Attributes:

None specified.

Writes Attributes:

None specified.

State management:

This component does not store state.

Restricted:

This component is not restricted.

Input requirement:

This component requires an incoming relationship.

System Resource Considerations:

None specified.

See Also:

GetHTMLElement, ModifyHTMLElement