org.apache.cocoon.components.elementprocessor
Interface ElementProcessor
- All Superinterfaces:
- Component
- All Known Subinterfaces:
- POIFSElementProcessor
- All Known Implementing Classes:
- BaseElementProcessor, EP_Bottom, EP_Default_, EP_Draft, EP_EvenIfOnlyStyles, EP_Footer, EP_Grid, EP_HCenter, EP_Header, EP_Left, EP_Monochrome, EP_Name, EP_Order, EP_Orientation, EP_Paper, EP_RepeatLeft, EP_RepeatTop, EP_Right, EP_Titles, EP_Top, EP_Type, EP_ValString, EP_Value, EP_VCenter, EPAttribute, EPAttributes, EPBottom, EPButton, EPCell, EPCellComment, EPCells, EPCheckbox, EPColInfo, EPCols, EPConstr, EPContent, EPDiagonal, EPFont, EPFooter, EPFrame, EPGeometry, EPHeader, EPItem, EPLabel, EPLeft, EPMargins, EPMaxCol, EPMaxRow, EPMerge, EPMergedRegions, EPName, EPNames, EPObjects, EPPrintInformation, EPRev_Diagonal, EPRight, EPRowInfo, EPRows, EPSelection, EPSelections, EPSheet, EPSheetName, EPSheetNameIndex, EPSheetObjectBonobo, EPSheetObjectFilled, EPSheets, EPSolver, EPStyle, EPStyleBorder, EPStyleRegion, EPStyles, EPSummary, EPTop, EPUIData, EPWorkbook, EPZoom
public interface ElementProcessor
- extends Component
The ElementProcessor interface defines behavior for classes that
can handle a particular XML element's content.
The life cycle of an ElementProcessor instance is:
- Creation
- Initialization via a call to initialize
- Acquisition of element data via calls to acceptCharacters
and acceptWhitespaceCharacters
- Completion of processing via a call to endProcessing
In response to a startElement event, the POIFSSerializer creates an
ElementProcessor, delegating the act of creation to an
ElementProcessorFactory, and then initializes the
ElementProcessor. In response to subsequent characters and
ignorableWhitespace events, the POIFSSerializer will pass data to
the ElementProcessor via the acceptCharacters or
acceptWhitespaceCharacters methods. Finally, in response to an
endElement event, the POIFSSerializer calls the ElementProcessor's
endProcessing method.
- Version:
- CVS $Id: ElementProcessor.html 1304258 2012-03-23 10:09:27Z ilgrosso $
- Author:
- Marc Johnson (marc_johnson27591@hotmail.com)
Method Summary |
void |
acceptCharacters(char[] data)
The data provided in this method call comes from the
corresponding XML element's contents. |
void |
acceptWhitespaceCharacters(char[] data)
The data provided in this method call comes from the
corresponding XML element's contents. |
void |
endProcessing()
This is the last method call executed by the
POIFSSerializer. |
void |
initialize(Attribute[] attributes,
ElementProcessor parent)
The implementation should walk the array of attributes and
perform appropriate actions based on that data. |
ROLE
static final String ROLE
initialize
void initialize(Attribute[] attributes,
ElementProcessor parent)
throws IOException
- The implementation should walk the array of attributes and
perform appropriate actions based on that data. The array of
attributes is guaranteed never to be null, but it can be
empty. An implementation can expect code like this to work
without throwing runtime exceptions:
for (int k = 0; k < attributes.length; k++)
{
Attribute attr = attributes[ k ];
// process attribute
}
NOTE: if the XML DTD or schema includes IMPLIED
attributes for an element, those attributes are not included in
the Attribute array - they're not in the data provided in the
startElement call. The constructor for the ElementProcessor
should set those implied attributes itself, and allow them to
be overridden if the XML source provided explicit values
for them.
The parent ElementProcessor is a reference to the
ElementProcessor whose corresponding XML element contains this
ElementProcessor's corresponding XML element. It will not be
null unless this ElementProcessor's corresponding XML element
is the top-level element in the XML document. Whether this
ElementProcessor needs to establish a containment relationship
with its parent or not, and whether it needs to do so at the
beginning, middle, or end of its life cycle, are private
matters left to the discretion of the individual
ElementProcessor implementation. If the ElementProcessor needs
to interact with its parent ElementProcessor, but is not ready
to do so when the initialize method is called, it must cache
the reference to its parent.
- Parameters:
attributes
- the array of Attribute instances; may be
empty, will never be nullparent
- the parent ElementProcessor; may be null
- Throws:
IOException
- if anything goes wrong
acceptCharacters
void acceptCharacters(char[] data)
- The data provided in this method call comes from the
corresponding XML element's contents. The array is guaranteed
not to be null and will never be empty.
The POIFSSerializer will make 0 to many calls to this method;
all such calls will occur after the initialize method is called
and before the endProcessing method is called.
Calls to this method may be interleaved with calls to
acceptWhitespaceCharacters. All calls to acceptCharacters and
acceptWhitespaceCharacters are guaranteed to be in the same
order as their data is in the element.
- Parameters:
data
- the character data
acceptWhitespaceCharacters
void acceptWhitespaceCharacters(char[] data)
- The data provided in this method call comes from the
corresponding XML element's contents. The array is guaranteed
not to be null and will never be empty.
The POIFSSerializer will make 0 to many calls to this method;
all such calls will occur after the initialize method is called
and before the endProcessing method is called.
Calls to this method may be interleaved with calls to
acceptCharacters. All calls to acceptCharacters and
acceptWhitespaceCharacters are guaranteed to be in the same
order as their data is in the element.
- Parameters:
data
- the whitespace characters
endProcessing
void endProcessing()
throws IOException
- This is the last method call executed by the
POIFSSerializer. When this method is called, the
ElementProcessor should finish its work and perform its final
interactions with its parent ElementProcessor.
If the implementation cached the parent ElementProcessor
reference, when the initialize method was called, it should
null out that reference.
- Throws:
IOException
Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.