Class ValidateXml

java.lang.Object
org.apache.nifi.components.AbstractConfigurableComponent
org.apache.nifi.processor.AbstractSessionFactoryProcessor
org.apache.nifi.processor.AbstractProcessor
org.apache.nifi.processors.standard.ValidateXml
All Implemented Interfaces:
org.apache.nifi.components.ConfigurableComponent, org.apache.nifi.processor.Processor

@SideEffectFree @SupportsBatching @InputRequirement(INPUT_REQUIRED) @Tags({"xml","schema","validation","xsd"}) @WritesAttributes(@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("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 org.apache.nifi.processor.AbstractProcessor
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    private static final List<org.apache.nifi.components.PropertyDescriptor>
     
    private static final XMLStreamReaderProvider
     
    static final org.apache.nifi.processor.Relationship
     
    static final org.apache.nifi.processor.Relationship
     
    private static final Set<org.apache.nifi.processor.Relationship>
     
    static final org.apache.nifi.components.PropertyDescriptor
     
    private static final String
     
    private static final SchemaValidator
     
    private final AtomicReference<Schema>
     
    static final org.apache.nifi.components.PropertyDescriptor
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Set<org.apache.nifi.processor.Relationship>
     
    protected List<org.apache.nifi.components.PropertyDescriptor>
     
    void
    onTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session)
     
    void
    parseSchema(org.apache.nifi.processor.ProcessContext context)
     
    private void
     

    Methods inherited from class org.apache.nifi.processor.AbstractProcessor

    onTrigger

    Methods inherited from class org.apache.nifi.processor.AbstractSessionFactoryProcessor

    getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, init, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrue

    Methods inherited from class org.apache.nifi.components.AbstractConfigurableComponent

    customValidate, equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, onPropertyModified, validate

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.apache.nifi.components.ConfigurableComponent

    getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validate

    Methods inherited from interface org.apache.nifi.processor.Processor

    isStateful, migrateProperties, migrateRelationships
  • Field Details

    • ERROR_ATTRIBUTE_KEY

      public static final String ERROR_ATTRIBUTE_KEY
      See Also:
    • SCHEMA_FILE

      public static final org.apache.nifi.components.PropertyDescriptor SCHEMA_FILE
    • XML_SOURCE_ATTRIBUTE

      public static final org.apache.nifi.components.PropertyDescriptor XML_SOURCE_ATTRIBUTE
    • PROPERTY_DESCRIPTORS

      private static final List<org.apache.nifi.components.PropertyDescriptor> PROPERTY_DESCRIPTORS
    • REL_VALID

      public static final org.apache.nifi.processor.Relationship REL_VALID
    • REL_INVALID

      public static final org.apache.nifi.processor.Relationship REL_INVALID
    • RELATIONSHIPS

      private static final Set<org.apache.nifi.processor.Relationship> RELATIONSHIPS
    • SCHEMA_LANGUAGE

      private static final String SCHEMA_LANGUAGE
      See Also:
    • SCHEMA_VALIDATOR

      private static final SchemaValidator SCHEMA_VALIDATOR
    • READER_PROVIDER

      private static final XMLStreamReaderProvider READER_PROVIDER
    • schemaRef

      private final AtomicReference<Schema> schemaRef
  • Constructor Details

    • ValidateXml

      public ValidateXml()
  • Method Details

    • getRelationships

      public Set<org.apache.nifi.processor.Relationship> getRelationships()
      Specified by:
      getRelationships in interface org.apache.nifi.processor.Processor
      Overrides:
      getRelationships in class org.apache.nifi.processor.AbstractSessionFactoryProcessor
    • getSupportedPropertyDescriptors

      protected List<org.apache.nifi.components.PropertyDescriptor> getSupportedPropertyDescriptors()
      Overrides:
      getSupportedPropertyDescriptors in class org.apache.nifi.components.AbstractConfigurableComponent
    • parseSchema

      @OnScheduled public void parseSchema(org.apache.nifi.processor.ProcessContext context) throws SAXException
      Throws:
      SAXException
    • onTrigger

      public void onTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session)
      Specified by:
      onTrigger in class org.apache.nifi.processor.AbstractProcessor
    • validate

      private void validate(InputStream in)