mirror of https://github.com/apache/nifi.git
Added documentation for the new expression language functions for escapes
Signed-off-by: Matt Burgess <mattyb149@apache.org>
This commit is contained in:
parent
219e0e96fb
commit
c385651209
|
@ -534,45 +534,6 @@ Each of the following functions manipulates a String in some way.
|
|||
|
||||
|
||||
|
||||
|
||||
[.function]
|
||||
=== urlEncode
|
||||
|
||||
*Description*: [.description]#Returns a URL-friendly version of the Subject. This is useful, for instance, when using an
|
||||
attribute value to indicate the URL of a website.#
|
||||
|
||||
*Subject Type*: [.subject]#String#
|
||||
|
||||
*Arguments*: No arguments
|
||||
|
||||
*Return Type*: [.returnType]#String#
|
||||
|
||||
*Examples*: We can URL-Encode an attribute named "url" by using the Expression `${url:urlEncode()}`. If
|
||||
the value of the "url" attribute is "https://nifi.apache.org/some value with spaces", this
|
||||
Expression will then return "https://nifi.apache.org/some%20value%20with%20spaces".
|
||||
|
||||
|
||||
|
||||
|
||||
[.function]
|
||||
=== urlDecode
|
||||
|
||||
*Description*: [.description]#Converts a URL-friendly version of the Subject into a human-readable form.#
|
||||
|
||||
*Subject Type*: [.subject]#String#
|
||||
|
||||
*Arguments*: No arguments
|
||||
|
||||
*Return Type*: [.returnType]#String#
|
||||
|
||||
*Examples*: If we have a URL-Encoded attribute named "url" with the value
|
||||
"https://nifi.apache.org/some%20value%20with%20spaces", then the Expression
|
||||
`${url:urlDecode()}` will return "https://nifi.apache.org/some value with spaces".
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[.function]
|
||||
=== substring
|
||||
|
||||
|
@ -993,6 +954,229 @@ Expressions will provide the following results:
|
|||
|
||||
|
||||
|
||||
[[escape]]
|
||||
== Escape Functions
|
||||
|
||||
Each of the following functions will escape a string according the rules of the given data format.
|
||||
|
||||
|
||||
|
||||
|
||||
[.function]
|
||||
=== escapeJson
|
||||
|
||||
*Description*: [.description]#This function prepares the Subject to be inserted into JSON document by escaping the characters
|
||||
in the String using Json String rules. The function correctly escapes quotes and control-chars (tab, backslash,
|
||||
cr, ff, etc.)#
|
||||
|
||||
*Subject Type*: [.subject]#String#
|
||||
|
||||
*Arguments*: No arguments
|
||||
|
||||
*Return Type*: [.returnType]#String#
|
||||
|
||||
*Examples*: If the "message" attribute is 'He didn't say, "Stop!"', then the Expression `${message:escapeJson()}`
|
||||
will return 'He didn't say, \"Stop!\"'
|
||||
|
||||
|
||||
|
||||
|
||||
[.function]
|
||||
=== escapeXml
|
||||
|
||||
*Description*: [.description]#This function prepares the Subject to be inserted into XML document by escaping the characters
|
||||
in a String using XML entities. The function correctly escapes quotes, apostrophe, ampersand, <, > and
|
||||
control-chars.#
|
||||
|
||||
*Subject Type*: [.subject]#String#
|
||||
|
||||
*Arguments*: No arguments
|
||||
|
||||
*Return Type*: [.returnType]#String#
|
||||
|
||||
*Examples*: If the "message" attribute is '"bread" & "butter"', then the Expression `${message:escapeXml()}`
|
||||
will return '"bread" & "butter"'
|
||||
|
||||
|
||||
|
||||
|
||||
[.function]
|
||||
=== escapeCsv
|
||||
|
||||
*Description*: [.description]#This function prepares the Subject to be inserted into CSV document by escaping the characters
|
||||
in a String using the rules in RFC 4180. The function correctly escapes quotes and surround the string in quotes if needed.#
|
||||
|
||||
*Subject Type*: [.subject]#String#
|
||||
|
||||
*Arguments*: No arguments
|
||||
|
||||
*Return Type*: [.returnType]#String#
|
||||
|
||||
*Examples*: If the "message" attribute is 'But finally, she left', then the Expression `${message:escapeCsv()}`
|
||||
will return '"But finally, she left"'
|
||||
|
||||
|
||||
|
||||
|
||||
[.function]
|
||||
=== escapeHtml3
|
||||
|
||||
*Description*: [.description]#This function prepares the Subject to be inserted into HTML document by escaping the characters
|
||||
in a String using the HTML entities. Supports only the HTML 3.0 entities.#
|
||||
|
||||
*Subject Type*: [.subject]#String#
|
||||
|
||||
*Arguments*: No arguments
|
||||
|
||||
*Return Type*: [.returnType]#String#
|
||||
|
||||
*Examples*: If the "message" attribute is '"bread" & "butter"', then the Expression `${message:escapeHtml3()}`
|
||||
will return '"bread" & "butter"'
|
||||
|
||||
|
||||
|
||||
|
||||
[.function]
|
||||
=== escapeHtml4
|
||||
|
||||
*Description*: [.description]#This function prepares the Subject to be inserted into HTML document by escaping the characters
|
||||
in a String using the HTML entities. Supports all known HTML 4.0 entities.#
|
||||
|
||||
*Subject Type*: [.subject]#String#
|
||||
|
||||
*Arguments*: No arguments
|
||||
|
||||
*Return Type*: [.returnType]#String#
|
||||
|
||||
*Examples*: If the "message" attribute is '"bread" & "butter"', then the Expression `${message:escapeHtml4()}`
|
||||
will return '"bread" & "butter"'
|
||||
|
||||
|
||||
|
||||
|
||||
[.function]
|
||||
=== unescapeJson
|
||||
|
||||
*Description*: [.description]#This function unescapes any Json literals found in the String.#
|
||||
|
||||
*Subject Type*: [.subject]#String#
|
||||
|
||||
*Arguments*: No arguments
|
||||
|
||||
*Return Type*: [.returnType]#String#
|
||||
|
||||
*Examples*: If the "message" attribute is 'He didn't say, \"Stop!\"', then the Expression `${message:unescapeJson()}`
|
||||
will return 'He didn't say, "Stop!"'
|
||||
|
||||
|
||||
|
||||
|
||||
[.function]
|
||||
=== unescapeXml
|
||||
|
||||
*Description*: [.description]#This function unescapes a string containing XML entity escapes to a string containing the
|
||||
actual Unicode characters corresponding to the escapes. Supports only the five basic XML entities (gt, lt,
|
||||
quot, amp, apos).#
|
||||
|
||||
*Subject Type*: [.subject]#String#
|
||||
|
||||
*Arguments*: No arguments
|
||||
|
||||
*Return Type*: [.returnType]#String#
|
||||
|
||||
*Examples*: If the "message" attribute is '"bread" & "butter"', then the Expression `${message:unescapeXml()}`
|
||||
will return '"bread" & "butter"'
|
||||
|
||||
|
||||
|
||||
|
||||
[.function]
|
||||
=== unescapeCsv
|
||||
|
||||
*Description*: [.description]#This function unescapes a String from a CSV document according to the rules of RFC 4180.#
|
||||
|
||||
*Subject Type*: [.subject]#String#
|
||||
|
||||
*Arguments*: No arguments
|
||||
|
||||
*Return Type*: [.returnType]#String#
|
||||
|
||||
*Examples*: If the "message" attribute is '"But finally, she left"', then the Expression `${message:unescapeCsv()}`
|
||||
will return 'But finally, she left'
|
||||
|
||||
|
||||
|
||||
|
||||
[.function]
|
||||
=== unescapeHtml3
|
||||
|
||||
*Description*: [.description]#This function unescapes a string containing HTML 3 entity to a string containing the
|
||||
actual Unicode characters corresponding to the escapes. Supports only HTML 3.0 entities.#
|
||||
|
||||
*Subject Type*: [.subject]#String#
|
||||
|
||||
*Arguments*: No arguments
|
||||
|
||||
*Return Type*: [.returnType]#String#
|
||||
|
||||
*Examples*: If the "message" attribute is '"bread" & "butter"', then the Expression `${message:unescapeHtml3()}`
|
||||
will return '"bread" & "butter"'
|
||||
|
||||
|
||||
|
||||
|
||||
[.function]
|
||||
=== unescapeHtml4
|
||||
|
||||
*Description*: [.description]#This function unescapes a string containing HTML 4 entity to a string containing the
|
||||
actual Unicode characters corresponding to the escapes. Supports all known HTML 4.0 entities.#
|
||||
|
||||
*Subject Type*: [.subject]#String#
|
||||
|
||||
*Arguments*: No arguments
|
||||
|
||||
*Return Type*: [.returnType]#String#
|
||||
|
||||
*Examples*: If the "message" attribute is '"bread" & "butter"', then the Expression `${message:unescapeHtml4()}`
|
||||
will return '"bread" & "butter"'
|
||||
|
||||
|
||||
|
||||
|
||||
[.function]
|
||||
=== urlEncode
|
||||
|
||||
*Description*: [.description]#Returns a URL-friendly version of the Subject. This is useful, for instance, when using an
|
||||
attribute value to indicate the URL of a website.#
|
||||
|
||||
*Subject Type*: [.subject]#String#
|
||||
|
||||
*Arguments*: No arguments
|
||||
|
||||
*Return Type*: [.returnType]#String#
|
||||
|
||||
*Examples*: We can URL-Encode an attribute named "url" by using the Expression `${url:urlEncode()}`. If
|
||||
the value of the "url" attribute is "https://nifi.apache.org/some value with spaces", this
|
||||
Expression will then return "https://nifi.apache.org/some%20value%20with%20spaces".
|
||||
|
||||
|
||||
|
||||
|
||||
[.function]
|
||||
=== urlDecode
|
||||
|
||||
*Description*: [.description]#Converts a URL-friendly version of the Subject into a human-readable form.#
|
||||
|
||||
*Subject Type*: [.subject]#String#
|
||||
|
||||
*Arguments*: No arguments
|
||||
|
||||
*Return Type*: [.returnType]#String#
|
||||
|
||||
*Examples*: If we have a URL-Encoded attribute named "url" with the value
|
||||
"https://nifi.apache.org/some%20value%20with%20spaces", then the Expression
|
||||
`${url:urlDecode()}` will return "https://nifi.apache.org/some value with spaces".
|
||||
|
||||
|
||||
|
||||
[[searching]]
|
||||
|
@ -1921,4 +2105,3 @@ provides several functions for evaluating the same conditions against groups of
|
|||
| `${allAttributes("abc", "non-existent-attr", "xyz"):count()}` | `2`
|
||||
| `${allMatchingAttributes(".*"):length():gt(10):count()}` | `2`
|
||||
|===========================================================================
|
||||
|
||||
|
|
Loading…
Reference in New Issue