- How to convert a file to xml how to#
- How to convert a file to xml install#
- How to convert a file to xml drivers#
- How to convert a file to xml update#
Here we learned to convert files from JSON data to XML format in NiFi.From line in tokens = Regex.Match(line, new XElement("Item", The output of the file stored in the local and data looks as below: Writes the contents of a FlowFile to the local file system, it means that we are storing the converted JSON content in the local directory for that we configured as below.Īs shown in the above image, we provided a directory name to store and access the file.
How to convert a file to xml update#
Step 5: Configure the UpdateAttribute to update file extensionĬonfigured the update attribute processor as below UpdateAttribute adds the file name with the XML extension as an attribute to the FlowFile. Here, we will give the name for the FlowFile. Updates the Attributes for a FlowFile using the Attribute Expression Language and/or deletes the attributes based on a regular expression. Step 4: Configure the UpdateAttribute to update the filename The output of the converted data looks as shown below: All the controller services should be enabled at this point.Ĭlick on the thunder symbol and enable them. Then after that, click on apply, and then you will be able to see the JsonTree Reader, and XML RecordWriter controller services then Select the lightning bolt icons for both of these services. This will then allow you to enable the JSonTreeReader and XMLRecordSetWriter controller services.Ĭonfigure the JSONTreeReader as shown below:Īnd also, configure the XML RecordsetWriter as shown below: In the property, we need to provide the schema name, and in the value Avro schema, click ok and Enable AvroSchemaRegistry by selecting the lightning bolt icon/button. Then click on the gear symbol and config as below: Select the Controller Services tab:Ĭlick on the "+" symbol to add the Avro schema registry it will add the Avro schema registry as the above image. This opens the NiFi Flow Configuration window. To Enable Controller Services Select the gear icon from the Operate Palette as shown in the image. Then you will get the pop up as below select XML reader in compatible controller service drop-down as shown below:įollow the same steps to create a controller service for the XML recordset writer as below. In Convert record processor, the properties tab in the RecordReader value column drop down will get as below, then click on create new service. Using a JSON controller service that references the same AvroSchemaRegistry schema
The AvroSchemaRegistry contains a "drivers" schema that defines information about each record (field names, field ids, field types) Using a JsonReader controller service that references a schema in an AvroSchemaRegistry controller service Step 3: Configure the ConvertRecord and Create Controller Services
How to convert a file to xml drivers#
Here we will use the UpdateAttribute to update the schema name for the avroschema registry as below.Īs shown above, we added a new attribute schema.name as drivers value. For that, we have configured the Input Directory and also provided the file name. Here we are ingesting the drivers_data.json file drivers data from a local directory. We scheduled this processor to run every 60 sec in the Run Schedule and Execution as the Primary node in the SCHEDULING tab. Here we are getting the file from the local directory. NiFi will ignore files it doesn't have at least read permissions for. Here in this scenario, we are going to convert the JSON data to XML format the JSON data looks like shown below:Ĭreates FlowFiles from files in a directory.
How to convert a file to xml install#
Install Ubuntu in the virtual machine.
How to convert a file to xml how to#
Recipe Objective: How to convert files from JSON data to XML format in NiFi?.