@EventDriven @SideEffectFree @SupportsBatching @Tags(value={"XML","evaluate","XPath"}) @InputRequirement(value=INPUT_REQUIRED) @CapabilityDescription(value="Evaluates one or more XPaths against the content of a FlowFile. The results of those XPaths are assigned to FlowFile Attributes or are written to the content of the FlowFile itself, depending on configuration of the Processor. XPaths 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 XPath expression. If the XPath evaluates to more than one node and the Return Type is set to \'nodeset\' (either directly, or via \'auto-detect\' with a Destination of \'flowfile-content\'), the FlowFile will be unmodified and will be routed to failure. If the XPath does not evaluate to a Node, the FlowFile will be routed to \'unmatched\' without having its contents modified. If Destination is flowfile-attribute and the expression matches nothing, attributes will be created with empty strings as the value, and the FlowFile will always be routed to \'matched\'") @WritesAttribute(attribute="user-defined", description="This processor adds user-defined attributes if the <Destination> property is set to flowfile-attribute.") @DynamicProperty(name="A FlowFile attribute(if <Destination> is set to \'flowfile-attribute\'", value="An XPath expression", description="If <Destination>=\'flowfile-attribute\' then the FlowFile attribute is set to the result of the XPath Expression. If <Destination>=\'flowfile-content\' then the FlowFile content is set to the result of the XPath Expression.") @SystemResourceConsiderations(value=@SystemResourceConsideration(resource=MEMORY,description="Processing requires reading the entire FlowFile into memory")) public class EvaluateXPath extends AbstractProcessor
| Modifier and Type | Class and Description |
|---|---|
private static class |
EvaluateXPath.XPathValidator |
| Modifier and Type | Field and Description |
|---|---|
static PropertyDescriptor |
DESTINATION |
static String |
DESTINATION_ATTRIBUTE |
static String |
DESTINATION_CONTENT |
private AtomicReference<XPathFactory> |
factoryRef |
private List<PropertyDescriptor> |
properties |
static Relationship |
REL_FAILURE |
static Relationship |
REL_MATCH |
static Relationship |
REL_NO_MATCH |
private Set<Relationship> |
relationships |
static PropertyDescriptor |
RETURN_TYPE |
static String |
RETURN_TYPE_AUTO |
static String |
RETURN_TYPE_NODESET |
static String |
RETURN_TYPE_STRING |
static PropertyDescriptor |
VALIDATE_DTD |
| Constructor and Description |
|---|
EvaluateXPath() |
| Modifier and Type | Method and Description |
|---|---|
protected Collection<ValidationResult> |
customValidate(ValidationContext context) |
Set<Relationship> |
getRelationships() |
protected PropertyDescriptor |
getSupportedDynamicPropertyDescriptor(String propertyDescriptorName) |
protected List<PropertyDescriptor> |
getSupportedPropertyDescriptors() |
protected void |
init(ProcessorInitializationContext context) |
void |
initializeXPathFactory() |
void |
onTrigger(ProcessContext context,
ProcessSession session) |
onTriggergetControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrueequals, getPropertyDescriptor, getPropertyDescriptors, hashCode, onPropertyModified, validateclone, finalize, getClass, notify, notifyAll, wait, wait, waitisStatefulgetPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validatepublic static final String DESTINATION_ATTRIBUTE
public static final String DESTINATION_CONTENT
public static final String RETURN_TYPE_AUTO
public static final String RETURN_TYPE_NODESET
public static final String RETURN_TYPE_STRING
public static final PropertyDescriptor DESTINATION
public static final PropertyDescriptor RETURN_TYPE
public static final PropertyDescriptor VALIDATE_DTD
public static final Relationship REL_MATCH
public static final Relationship REL_NO_MATCH
public static final Relationship REL_FAILURE
private Set<Relationship> relationships
private List<PropertyDescriptor> properties
private final AtomicReference<XPathFactory> factoryRef
protected void init(ProcessorInitializationContext context)
init in class AbstractSessionFactoryProcessorprotected Collection<ValidationResult> customValidate(ValidationContext context)
customValidate in class AbstractConfigurableComponentpublic Set<Relationship> getRelationships()
getRelationships in interface ProcessorgetRelationships in class AbstractSessionFactoryProcessorprotected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors in class AbstractConfigurableComponent@OnScheduled public void initializeXPathFactory()
protected PropertyDescriptor getSupportedDynamicPropertyDescriptor(String propertyDescriptorName)
getSupportedDynamicPropertyDescriptor in class AbstractConfigurableComponentpublic void onTrigger(ProcessContext context, ProcessSession session)
onTrigger in class AbstractProcessorCopyright © 2023 Apache NiFi Project. All rights reserved.