Skip to main content

EvaluateXQuery

Description

Evaluates one or more XQueries against the content of a FlowFile. The results of those XQueries are assigned to FlowFile Attributes or are written to the content of the FlowFile itself, depending on configuration of the Processor. XQueries are entered by adding user-defined properties; the name of the property maps to the Attribute Name into which the result will be placed (if the Destination is 'flowfile-attribute'; otherwise, the property name is ignored). The value of the property must be a valid XQuery. If the XQuery returns more than one result, new attributes or FlowFiles (for Destinations of 'flowfile-attribute' or 'flowfile-content' respectively) will be created for each result (attributes will have a '.n' one-up number appended to the specified attribute name). If any provided XQuery returns a result, the FlowFile(s) will be routed to 'matched'. If no provided XQuery returns a result, the FlowFile will be routed to 'unmatched'. If the Destination is 'flowfile-attribute' and the XQueries matche nothing, no attributes will be applied to the FlowFile.

Tags

XML, XPath, XQuery, evaluate

Properties

In the list below required Properties are shown with an asterisk (*). Other properties are considered optional. The table also indicates any default values, and whether a property supports the NiFi Expression Language.

Display NameAPI NameDefault ValueAllowable ValuesDescription
Destination *Destinationflowfile-content
  • flowfile-content
  • flowfile-attribute
Indicates whether the results of the XQuery evaluation are written to the FlowFile content or a FlowFile attribute. If set to <flowfile-content>, only one XQuery may be specified and the property name is ignored. If set to <flowfile-attribute> and the XQuery returns more than one result, multiple attributes will be added to theFlowFile, each named with a '.n' one-up number appended to the specified attribute name
Output: Method *Output: Methodxml
  • xml
  • html
  • text
Identifies the overall method that should be used for outputting a result tree.
Output: Omit XML Declaration *Output: Omit XML DeclarationfalseSpecifies whether the processor should output an XML declaration when transforming a result tree.
Output: Indent *Output: IndentfalseSpecifies whether the processor may add additional whitespace when outputting a result tree.
Allow DTD *Validate DTDfalse
  • true
  • false
Allow embedded Document Type Declaration in XML. This feature should be disabled to avoid XML entity expansion vulnerabilities.

Dynamic Properties

NameValueDescription
A FlowFile attribute(if <Destination> is set to 'flowfile-attribute'An XQueryIf <Destination>='flowfile-attribute' then the FlowFile attribute is set to the result of the XQuery. If <Destination>='flowfile-content' then the FlowFile content is set to the result of the XQuery.

Supports Expression Language: No

Relationships

NameDescription
failureFlowFiles are routed to this relationship when the XQuery cannot be evaluated against the content of the FlowFile.
matchedFlowFiles are routed to this relationship when the XQuery is successfully evaluated and the FlowFile is modified as a result
unmatchedFlowFiles are routed to this relationship when the XQuery does not match the content of the FlowFile and the Destination is set to flowfile-content

Reads Attributes

This processor does not read attributes.

Writes Attributes

NameDescription
user-definedThis processor adds user-defined attributes if the <Destination> property is set to flowfile-attribute .

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

ScopeDescription
MEMORYProcessing requires reading the entire FlowFile into memory

See Also