Class ElementTransformingFragmentTransformer

java.lang.Object
com.atlassian.confluence.content.render.xhtml.transformers.ElementTransformingFragmentTransformer
All Implemented Interfaces:
FragmentTransformer

public class ElementTransformingFragmentTransformer extends Object implements FragmentTransformer

A FragmentTransformer that can be configured to transform individual Elements it reads.

Typically you would configure ElementTransformers directly on the DefaultFragmentTransformer to transform individual elements but this FragmentTransformer can be used when you want to reduce the scope of the ElementTransform to just a Fragment of the full XML document being read.

This FragmentTransformer makes use of the ConversionContext to store a flag which ensures that this transformer instance will only apply once per ConversionContext. (There is no point in transforming elements multiple times and it could lead to infinite loops if we didn't consume the triggering event. If we do consume the triggering event then the mainFragmentTransformer will fail because it will encounter the closing event without having seen the opening event.)

Rather than having multiple ElementTransformingFragmentTransformer in the pipeline it would be preferable to have only a single one if possible but instead with multiple ElementTransformers configured.