Class AbstractWriterRegistry

java.lang.Object
org.docx4j.convert.out.common.AbstractWriterRegistry

public abstract class AbstractWriterRegistry extends Object
There is one instance of the WriterRegistry for each output type (eg. FO, HTML). The WriterRegistry manages the Writers and then converts dom nodes using the registered @see org.docx4j.convert.out.common.Writer Writer classes on the other hand are customized, they are to be registered by the caller, and they are singletons. Registration uses the node name as key value.

Here is an example how you might want to call Converter from an xslt file

 <xsl:template match="foo">
   <xsl:variable name="me" select="."/>
   <xsl:variable name="children">
      <xsl:apply-templates/>
   </xsl:variable>
   <xsl:copy-of select="java:org.docx4j.convert.out.Converter.toNode($me, $children)"/>
   ...
 
This assumes that a writer is registered for "foo".
Author:
Adam Schmideg
  • Constructor Details

    • AbstractWriterRegistry

      public AbstractWriterRegistry()
  • Method Details

    • registerDefaultWriterInstances

      protected abstract void registerDefaultWriterInstances()
    • registerWriter

      public void registerWriter(Writer converter)
    • createTransformStates

      public Map<String,Writer.TransformState> createTransformStates()
      Factory Method to create the required Transform States for the context
      Returns:
    • toNode

      public Node toNode(AbstractWmlConversionContext context, Node node, NodeList childResults)
      This method is called from the converters with XSL-Transformations
      Parameters:
      node -
      childResults - the already transformed node (element) content
      doc -
      Returns:
    • toNode

      public Node toNode(AbstractWmlConversionContext context, Object unmarshalledNode, String modelID, Node content, Document doc)
      This method is called from the converters that don't use XSLT
      Parameters:
      node -
      childResults - the already transformed node (element) content
      doc -
      Returns: