Save This Page
Home » cocoon-2.1.11-src » org.apache » cocoon » serialization » hssfhelpers » [javadoc | source]
org.apache.cocoon.serialization.hssfhelpers
public interface: ElementProcessor [javadoc | source]

All Known Implementing Classes:
    EP_ValString, EPHeader, EPSheet, EPSolver, EP_Draft, EPCols, EP_Titles, EPStyle, EPStyleBorder, EPRows, EPZoom, EPObjects, EPPrintInformation, EPCheckbox, EP_Grid, EPSelection, EP_Type, BEP4, EPColInfo, EP, EPMaxRow, EPUIData, EPName, EP_Paper, EPSummary, EP_Orientation, EP_Footer, EPRowInfo, EPFrame, EPConstr, EP_EvenIfOnlyStyles, EPRight, EP_Monochrome, EPWorkbook, EPSheets, EP_Right, EP_Order, EPMargins, EPFooter, EPLeft, BEP3, EPSheetObjectBonobo, EPSelections, EPBottom, EPItem, EPStyleRegion, EPNames, EPFont, EP_Left, EPAttributes, EP_RepeatTop, EPCells, EP_Bottom, EPCellComment, EPSheetObjectFilled, EPTop, EP_VCenter, EPRev_Diagonal, EP_Top, BaseElementProcessor, EP_HCenter, EPDiagonal, EPContent, EP_Name, EPButton, EP_Header, EPSheetName, NoOpElementProcessor, EPLabel, EPCell, EPStyles, EPAttribute, EP_Value, EPGeometry, EP_RepeatLeft, EPMaxCol, EPSheetNameIndex

The ElementProcessor interface defines behavior for classes that can handle a particular XML element's content.
The life cycle of an ElementProcessor instance is:
  1. Creation
  2. Initialization via a call to initialize
  3. Acquisition of element data via calls to acceptCharacters and acceptWhitespaceCharacters
  4. 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.
Method from org.apache.cocoon.serialization.hssfhelpers.ElementProcessor Summary:
acceptCharacters,   acceptWhitespaceCharacters,   endProcessing,   initialize
Method from org.apache.cocoon.serialization.hssfhelpers.ElementProcessor Detail:
 public  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.
 public  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.
 public  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 and the filesystem, if necessary.
    If the implementation cached the parent ElementProcessor reference, the filesystem reference, or both, when the initialize method was called, it should null out those references.
 public  void initialize(Attribute[] attributes,
    ElementProcessor parent,
    Filesystem filesystem) 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.
    Similarly, whether the ElementProcessor implementation needs to interact with the filesystem is a private decision of the implementation. At this time, the only intelligent action an ElementProcessor could take would be to create a document and add it to the filesystem, but future expansion of the filesystem class's public methods could, and will, lead to other forms of meaningful interaction between the ElementProcessor and the filesystem. If the ElementProcessor needs to interact with the filesystem, but is not ready to do so when the initialize method is called, it must cache the reference.
    The filesystem reference will never be null.