@EventDriven @SideEffectFree @SupportsBatching @InputRequirement(value=INPUT_REQUIRED) @Tags(value={"xml","schema","validation","xsd"}) @WritesAttributes(value=@WritesAttribute(attribute="validatexml.invalid.error",description="If the flow file is routed to the invalid relationship the attribute will contain the error message resulting from the validation failure.")) @CapabilityDescription(value="Validates XML contained in a FlowFile. By default, the XML is contained in the FlowFile content. If the \'XML Source Attribute\' property is set, the XML to be validated is contained in the specified attribute. It is not recommended to use attributes to hold large XML documents; doing so could adversely affect system performance. Full schema validation is performed if the processor is configured with the XSD schema details. Otherwise, the only validation performed is to ensure the XML syntax is correct and well-formed, e.g. all opening tags are properly closed.") @SystemResourceConsideration(resource=MEMORY, description="While this processor supports processing XML within attributes, it is strongly discouraged to hold large amounts of data in attributes. In general, attribute values should be as small as possible and hold no more than a couple hundred characters.") @Restricted(restrictions=@Restriction(requiredPermission=REFERENCE_REMOTE_RESOURCES,explanation="Schema configuration can reference resources over HTTP")) public class ValidateXml extends AbstractProcessor
| Modifier and Type | Field and Description |
|---|---|
static String |
ERROR_ATTRIBUTE_KEY |
private List<PropertyDescriptor> |
properties |
private static XMLStreamReaderProvider |
READER_PROVIDER |
static Relationship |
REL_INVALID |
static Relationship |
REL_VALID |
private Set<Relationship> |
relationships |
static PropertyDescriptor |
SCHEMA_FILE |
private static String |
SCHEMA_LANGUAGE |
private static SchemaValidator |
SCHEMA_VALIDATOR |
private AtomicReference<Schema> |
schemaRef |
static PropertyDescriptor |
XML_SOURCE_ATTRIBUTE |
| Constructor and Description |
|---|
ValidateXml() |
| Modifier and Type | Method and Description |
|---|---|
Set<Relationship> |
getRelationships() |
protected List<PropertyDescriptor> |
getSupportedPropertyDescriptors() |
protected void |
init(ProcessorInitializationContext context) |
void |
onTrigger(ProcessContext context,
ProcessSession session) |
void |
parseSchema(ProcessContext context) |
private void |
validate(InputStream in) |
onTriggergetControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTruecustomValidate, equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, onPropertyModified, validateclone, finalize, getClass, notify, notifyAll, wait, wait, waitisStatefulgetPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validatepublic static final String ERROR_ATTRIBUTE_KEY
public static final PropertyDescriptor SCHEMA_FILE
public static final PropertyDescriptor XML_SOURCE_ATTRIBUTE
public static final Relationship REL_VALID
public static final Relationship REL_INVALID
private static final String SCHEMA_LANGUAGE
private static final SchemaValidator SCHEMA_VALIDATOR
private static final XMLStreamReaderProvider READER_PROVIDER
private List<PropertyDescriptor> properties
private Set<Relationship> relationships
private final AtomicReference<Schema> schemaRef
protected void init(ProcessorInitializationContext context)
init in class AbstractSessionFactoryProcessorpublic Set<Relationship> getRelationships()
getRelationships in interface ProcessorgetRelationships in class AbstractSessionFactoryProcessorprotected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors in class AbstractConfigurableComponent@OnScheduled public void parseSchema(ProcessContext context) throws SAXException
SAXExceptionpublic void onTrigger(ProcessContext context, ProcessSession session)
onTrigger in class AbstractProcessorprivate void validate(InputStream in)
Copyright © 2023 Apache NiFi Project. All rights reserved.