Support Questions

Find answers, ask questions, and share your expertise

how do you specify a content viewer in Apache NiFi

avatar

The analyze traffic patterns with NiFi tutorial creates files with content type html/xml. When I click on the EvaluateXPath processor and select Data Provenance. Then click on info icon of a provenance entry. Then click on the Content tab and click the View button. The content type is text/html and the view pane says "No viewer registered for this content type."

How can I register a viewer for html/xml or specify a different content type such as text/xml or application/xml?

1 ACCEPTED SOLUTION
5 REPLIES 5

avatar
Expert Contributor

The easiest "hack" is to give it a filename ending in .xml it could be update attribute Filename | ${Filename}.xml

avatar
Master Guru

avatar

I added an UpdateAttribute processor and set the mime.type Property to application/xml. The viewer was not able to render text/xml:

9273-screen-shot-2016-11-09-at-82310-am.png

9272-screen-shot-2016-11-09-at-82158-am.png

avatar
Rising Star

Was the HTML content actually valid XML?

Did the content viewer open? If so, is the content viewer unable to show the content in it's 'formatted' form? What about the 'original' or 'hex' forms?

avatar
Rising Star

As was previously mentioned, the content type is specified in the flowfile attribute mime.type. Some Processors will automatically set this value. However, UpdateAttribute can be used to explicitly set it.

There is no content viewer for HTML bundled with Apache NiFi currently. This is an extension point so one could be developed and dropped into your instance. Alternatively, you could just use application/xml or text/plain.