Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

how do you specify a content viewer in Apache NiFi

Solved Go to solution

how do you specify a content viewer in Apache NiFi

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

Accepted Solutions
Highlighted

Re: how do you specify a content viewer in Apache NiFi

Super Guru
5 REPLIES 5
Highlighted

Re: how do you specify a content viewer in Apache NiFi

Contributor

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

Highlighted

Re: how do you specify a content viewer in Apache NiFi

Super Guru
Highlighted

Re: how do you specify a content viewer in Apache NiFi

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

Highlighted

Re: how do you specify a content viewer in Apache NiFi

Contributor

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?

Highlighted

Re: how do you specify a content viewer in Apache NiFi

Contributor

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.

Don't have an account?
Coming from Hortonworks? Activate your account here