This documentation is for an outdated version: 14.6.13. The current version is 14.6.17 - get the documentation here.

Flow action parse

The parse action inspects the main content in fit://request/content. If it can be parsed into a DOM, the flow continues. Otherwise the request is terminated and the content sent to the client. This way the action guarantees that all subsequent actions find a DOM in fit://request/content.

This action is part of the default flow.

Syntax

This action has no options.

Example:

<flow>
  <default-request />
  <parse />
</flow>

Behavior

The action is idempotent: If the main content is already parsed, it has no effect.

Before the actual parsing is done, text filters are applied to the content. This is configurable in conf/config.xml.

Parsing

The action has two ways to determine how to handle the main content:

  • Purpose of the request, that is passed to FIT as URL Mark m, which in turn is set by the URL rewriter
  • Using meta data of the content, which is usually provided by the request actions

The request purpose, which is set automatically only for <script> or <link rel="stylesheet"> elements, has precedence over the content type. You can use this manually to handle JSON data.

If the meta data is used, the parser is derived from the content type. Most XML and HTML content types are detected automatically. However, you can overwrite the parser with the request option <parser value="xml|html" />.

Content Handling

  • CSS content is sent through URL rewriting
  • Images are dumped or, if enabled, scaled according to the default settings from ress/image-scaling
  • non-DOM content (e.g. JS, CSS, text, JSON) is dumped (and minified if applicable)
  • if configured, JSON content is converted to XML
  • XML and HTML content is parsed into a DOM. HTML5 compliant parsing can be enabled in conf/config.xml.
  • DOM filters are applied

Errors

The request will be terminated, if no main content is found. That is, fit://request/content is empty and no Content-type header could be obtained via meta data. Usually that means that your flow path is lacking any content generator (as copy or requests).