Provides an interface for transforming content from one format to
another.
Package Specification
Purpose
Interfaces and Classes
Implementation Notes
Related Documentation
The
processor is part of the
publishing pipeline. It is responsible for transforming the layout or
format of content that has been appropriately prepared. Within the
pipeline, an object called a
producer
prepares content for a transformation by creating an XML DOM or stream
and passing this on to the processor. The processor then transforms the
format or layout of the content with the help of a stylesheet.
Interfaces and
Classes
The
processorpackage
contains
the
IProcessor
interface and a
DefaultProcessor
class. The
DefaultProcessor
class has a special role that is explained below.
IProcessor
This interface defines a single
process
method that defines the logic for the transformation of content.
Any processor that works together with the publishing pipeline must
implement this interface.Different implementations of the interface are
available in the KM framework and can be used for different types
of transformations. See
Implementation
Notes.
DefaultProcessor
This class represents a processor that does
not transform content, but supplies
instructions for the pipeline controller. The pipeline controller is an
internal component that supervises the processing steps that are
performed by the pipeline on the basis of instructions it finds in an
XML file. The instructions state the processor type that must be called,
the location of the stylesheet that is to be used and the mime type of
the output. If no XML instructions are available, it is the task of the
default processor to provide these. It offers methods to
add processing instructions to an XML.
In
most cases the default processor is called internally, within the
pipeline. However, when the transformation of a non-XML file is
performed, then the default processor must be called explicitly to
supply the pipeline with processing instructions.
The example shows instructions that
inform the controller to start an XSLT processor, to use the stylesheet page.xsl and to run a formatter program that generates HTML.
<?wcm-process
type="xslt"?>
<?xml-stylesheet href="page.xsl" type="text/xsl?">
<?wcm-format
type="text/html"?>
Implementation Notes
The KM Platform offers different
implementations of processors to serve different purposes. The following
processor types are available:
- An HTML processor that merges an HTML input stream
with a CSS stylesheet. The result is an HTML with a new layout.
- An XSLT processor that converts an XML
DOM with an XSLT stylesheet.
The result differs depending on the type of stylesheet that is applied.
Note that if
the XSLT processor generates an XML DOM for formats like SVG, PDF, HTML or VRML, then a formatter program must complete
the transformation process by creating the output format.
Related Documentation
For information on the different components that play role in the
publishing pipeline see:
com.sapportals.wcm.service.pipeline
com.sapportals.wcm.service.pipeline.producer
com.sapportals.wcm.service.pipeline.formatter