Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.dvsl
Class Transformer

    java.lang.Object
      org.apache.dvsl.Transformer

All Implemented Interfaces:
  TransformTool

     class Transformer

extends java.lang.Object
implements TransformTool

Class responsible for actual transformation of documents.

Note that this class is not threadsafe.

Author:

  Field Summary
  `private java.util.Map` | `appValue` HashMap to hold application values
  `private org.apache.velocity.context.Context` | `baseContext` basic context passed to us - can contain tools and such for use.
  `private DVSLNodeContext` | `currentContext` context used during processing.
  `private org.dom4j.io.SAXReader` | `saxReader` SAXReader that we reuse for every document.
  `private TemplateHandler` | `templateHandler`
  `private org.apache.velocity.app.VelocityEngine` | `ve` Instance of VelocityEngine we are currently using.

  Constructor Summary
  `private` | `Transformer()` "Sealed for your protection."
  `` | `Transformer(org.apache.velocity.app.VelocityEngine ve, TemplateHandler th, org.apache.velocity.context.Context context, java.util.Map applicationValues, boolean validate)` Sole public CTOR.

  Method Summary
  `java.lang.String` | `applyTemplates()`
  `java.lang.String` | `applyTemplates(DVSLNode node)`
  `java.lang.String` | `applyTemplates(DVSLNode node, java.lang.String xpath)`
  `java.lang.String` | `applyTemplates(java.lang.String path)` Applies templates in the current stylesheet to the nodeset returned by the XPath expression
  `java.lang.String` | `copy()`
  `java.lang.Object` | `get(java.lang.String key)`
  `java.lang.Object` | `getAppValue(java.lang.Object key)`
  `private void` | `invoke(DVSLNode element, java.io.Writer writer)`
  `java.lang.Object` | `putAppValue(java.lang.Object key, java.lang.Object value)`
  `(package private) long` | `transform(org.dom4j.Document dom4jdoc, java.io.Writer writer)`
  `protected long` | `transform(DVSLNode root, java.io.Writer writer)`
  `(package private) long` | `transform(java.io.Reader reader, java.io.Writer writer)` Method that performs the transformation on a document

  Methods inherited from class java.lang.Object
  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  Field Detail

  ### ve

      private org.apache.velocity.app.VelocityEngine ve

    Instance of VelocityEngine we are currently using. This must be reset with a stylesheeet change

  ### saxReader

      private org.dom4j.io.SAXReader saxReader

    SAXReader that we reuse for every document. Much faster.

  ### baseContext

      private org.apache.velocity.context.Context baseContext

    basic context passed to us - can contain tools and such for use. Is protected from change via wrapping

  ### currentContext

      private DVSLNodeContext currentContext

    context used during processing. Wraps the baseContext

  ### templateHandler

      private TemplateHandler templateHandler

  ### appValue

      private java.util.Map appValue

    HashMap to hold application values

  Constructor Detail

  ### Transformer

      public Transformer(org.apache.velocity.app.VelocityEngine ve,
                         TemplateHandler th,
                         org.apache.velocity.context.Context context,
                         java.util.Map applicationValues,
                         boolean validate)

    Sole public CTOR. We rely on the caller to give us a VelocityEngine ready with all macros registered. The context is the callers context with all tools and style drek.

  ### Transformer

      private Transformer()

    "Sealed for your protection."

  Method Detail

  ### transform

      long transform(java.io.Reader reader,
                     java.io.Writer writer)
               throws java.lang.Exception

    Method that performs the transformation on a document

    Parameters:
      `reader` - XML document char stream
      `writer` - Writer to output transformation to
    Throws:
      `java.lang.Exception`

  ### transform

      long transform(org.dom4j.Document dom4jdoc,
                     java.io.Writer writer)
               throws java.lang.Exception

    Throws:
      `java.lang.Exception`

  ### transform

      protected long transform(DVSLNode root,
                               java.io.Writer writer)
                        throws java.lang.Exception

    Throws:
      `java.lang.Exception`

  ### invoke

      private void invoke(DVSLNode element,
                          java.io.Writer writer)
                   throws java.lang.Exception

    Throws:
      `java.lang.Exception`

  ### get

      public java.lang.Object get(java.lang.String key)

    Specified by:
      `get` in interface `TransformTool`

  ### applyTemplates

      public java.lang.String applyTemplates(DVSLNode node,
                                             java.lang.String xpath)
                                      throws java.lang.Exception

    Specified by:
      `applyTemplates` in interface `TransformTool`
    Throws:
      `java.lang.Exception`

  ### applyTemplates

      public java.lang.String applyTemplates(DVSLNode node)
                                      throws java.lang.Exception

    Specified by:
      `applyTemplates` in interface `TransformTool`
    Throws:
      `java.lang.Exception`

  ### applyTemplates

      public java.lang.String applyTemplates()
                                      throws java.lang.Exception

    Specified by:
      `applyTemplates` in interface `TransformTool`
    Throws:
      `java.lang.Exception`

  ### applyTemplates

      public java.lang.String applyTemplates(java.lang.String path)
                                      throws java.lang.Exception

    Description copied from interface: `TransformTool`

    Applies templates in the current stylesheet to the nodeset returned by the XPath expression

    Specified by:
      `applyTemplates` in interface `TransformTool`
    Parameters:
      `path` - XPath expression to select nodes
    Returns:
      The rendered result
    Throws:
      `java.lang.Exception`

  ### copy

      public java.lang.String copy()

    Specified by:
      `copy` in interface `TransformTool`

  ### getAppValue

      public java.lang.Object getAppValue(java.lang.Object key)

    Specified by:
      `getAppValue` in interface `TransformTool`

  ### putAppValue

      public java.lang.Object putAppValue(java.lang.Object key,
                                          java.lang.Object value)

    Specified by:
      `putAppValue` in interface `TransformTool`

  Overview | Package | Class | Tree | Deprecated | Index | Help
  PREV CLASS NEXT CLASS | FRAMES NO FRAMES
  SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

  Copyright (c) 2001-2007 Apache Software Foundation