com.atlassian.confluence.content.render.xhtml.transformers
Class DefaultFragmentTransformer

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

public class DefaultFragmentTransformer
extends Object
implements FragmentTransformer

This can be thought of as the top-level Transformer since it includes the behaviour of writing out any events that have no specific handling configured.

There are two ways of causing transformation:

  1. Configure a List of ElementTransformer which will transform individual elements read.
  2. Configure a List of FragmentTransformer which will take well formed fragments of XML and transform them.
These two mechanisms can be combined.

Note that in both FragmentTransformer and ElementTransformer the order of the configured transformers is the order they are applied. All ElementTransformer are applied before FragmentTransformer.

If you prefer to scope the application of ElementTransformer to a particular fragment of XML then instead of configuring them here in the DefaultFragmentTransformer you should instead use an ElementTransformingFragmentTransformer which will scope the Element transformations to a particular fragment of XML.


Constructor Summary
DefaultFragmentTransformer(List<? extends FragmentTransformer> fragmentTransformers, XMLOutputFactory xmlFragmentOutputFactory, XmlEventReaderFactory xmlEventReaderFactory, FragmentTransformationErrorHandler fragmentTransformationErrorHandler, com.atlassian.event.api.EventPublisher eventPublisher)
           
DefaultFragmentTransformer(List<ElementTransformer> elementTransformers, List<? extends FragmentTransformer> fragmentTransformers, XMLOutputFactory xmlFragmentOutputFactory, XmlEventReaderFactory xmlEventReaderFactory, FragmentTransformationErrorHandler fragmentTransformationErrorHandler, com.atlassian.event.api.EventPublisher eventPublisher)
           
 
Method Summary
 boolean handles(StartElement startElementEvent, ConversionContext conversionContext)
          This fragment converter handles every XHTML element that is not handled by any other converter.
 String transform(XMLEventReader reader, FragmentTransformer defaultFragmentTransformer, ConversionContext conversionContext)
          Transform the XML read from the supplied reader, making use of any configured FragmentTransformers as appropriate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultFragmentTransformer

public DefaultFragmentTransformer(List<? extends FragmentTransformer> fragmentTransformers,
                                  XMLOutputFactory xmlFragmentOutputFactory,
                                  XmlEventReaderFactory xmlEventReaderFactory,
                                  FragmentTransformationErrorHandler fragmentTransformationErrorHandler,
                                  com.atlassian.event.api.EventPublisher eventPublisher)

DefaultFragmentTransformer

public DefaultFragmentTransformer(List<ElementTransformer> elementTransformers,
                                  List<? extends FragmentTransformer> fragmentTransformers,
                                  XMLOutputFactory xmlFragmentOutputFactory,
                                  XmlEventReaderFactory xmlEventReaderFactory,
                                  FragmentTransformationErrorHandler fragmentTransformationErrorHandler,
                                  com.atlassian.event.api.EventPublisher eventPublisher)
Method Detail

transform

public String transform(XMLEventReader reader,
                        FragmentTransformer defaultFragmentTransformer,
                        ConversionContext conversionContext)
                 throws XhtmlException
Transform the XML read from the supplied reader, making use of any configured FragmentTransformers as appropriate.

Specified by:
transform in interface FragmentTransformer
Throws:
XhtmlException

handles

public boolean handles(StartElement startElementEvent,
                       ConversionContext conversionContext)
This fragment converter handles every XHTML element that is not handled by any other converter.

Specified by:
handles in interface FragmentTransformer


Copyright © 2003-2013 Atlassian. All Rights Reserved.