Home | History | Annotate | Download | only in serializer
      1 /*
      2  * Licensed to the Apache Software Foundation (ASF) under one
      3  * or more contributor license agreements. See the NOTICE file
      4  * distributed with this work for additional information
      5  * regarding copyright ownership. The ASF licenses this file
      6  * to you under the Apache License, Version 2.0 (the  "License");
      7  * you may not use this file except in compliance with the License.
      8  * You may obtain a copy of the License at
      9  *
     10  *     http://www.apache.org/licenses/LICENSE-2.0
     11  *
     12  * Unless required by applicable law or agreed to in writing, software
     13  * distributed under the License is distributed on an "AS IS" BASIS,
     14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     15  * See the License for the specific language governing permissions and
     16  * limitations under the License.
     17  */
     18 /*
     19  * $Id: SerializerTrace.java 468654 2006-10-28 07:09:23Z minchau $
     20  */
     21 package org.apache.xml.serializer;
     22 
     23 import org.xml.sax.Attributes;
     24 
     25 /**
     26  * This interface defines a set of integer constants that identify trace event
     27  * types.
     28  *
     29  * @xsl.usage internal
     30  */
     31 
     32 public interface SerializerTrace {
     33 
     34   /**
     35    * Event type generated when a document begins.
     36    *
     37    */
     38   public static final int EVENTTYPE_STARTDOCUMENT = 1;
     39 
     40   /**
     41    * Event type generated when a document ends.
     42    */
     43   public static final int EVENTTYPE_ENDDOCUMENT = 2;
     44 
     45   /**
     46    * Event type generated when an element begins (after the attributes have been processed but before the children have been added).
     47    */
     48   public static final int EVENTTYPE_STARTELEMENT = 3;
     49 
     50   /**
     51    * Event type generated when an element ends, after it's children have been added.
     52    */
     53   public static final int EVENTTYPE_ENDELEMENT = 4;
     54 
     55   /**
     56    * Event type generated for character data (CDATA and Ignorable Whitespace have their own events).
     57    */
     58   public static final int EVENTTYPE_CHARACTERS = 5;
     59 
     60   /**
     61    * Event type generated for ignorable whitespace (I'm not sure how much this is actually called.
     62    */
     63   public static final int EVENTTYPE_IGNORABLEWHITESPACE = 6;
     64 
     65   /**
     66    * Event type generated for processing instructions.
     67    */
     68   public static final int EVENTTYPE_PI = 7;
     69 
     70   /**
     71    * Event type generated after a comment has been added.
     72    */
     73   public static final int EVENTTYPE_COMMENT = 8;
     74 
     75   /**
     76    * Event type generate after an entity ref is created.
     77    */
     78   public static final int EVENTTYPE_ENTITYREF = 9;
     79 
     80   /**
     81    * Event type generated after CDATA is generated.
     82    */
     83   public static final int EVENTTYPE_CDATA = 10;
     84 
     85   /**
     86    * Event type generated when characters might be written to an output stream,
     87    *  but  these characters never are. They will ultimately be written out via
     88    * EVENTTYPE_OUTPUT_CHARACTERS. This type is used as attributes are collected.
     89    * Whenever the attributes change this event type is fired. At the very end
     90    * however, when the attributes do not change anymore and are going to be
     91    * ouput to the document the real characters will be written out using the
     92    * EVENTTYPE_OUTPUT_CHARACTERS.
     93    */
     94   public static final int EVENTTYPE_OUTPUT_PSEUDO_CHARACTERS = 11;
     95 
     96   /**
     97    * Event type generated when characters are written to an output stream.
     98    */
     99   public static final int EVENTTYPE_OUTPUT_CHARACTERS = 12;
    100 
    101 
    102   /**
    103    * Tell if trace listeners are present.
    104    *
    105    * @return True if there are trace listeners
    106    */
    107   public boolean hasTraceListeners();
    108 
    109   /**
    110    * Fire startDocument, endDocument events.
    111    *
    112    * @param eventType One of the EVENTTYPE_XXX constants.
    113    */
    114   public void fireGenerateEvent(int eventType);
    115 
    116   /**
    117    * Fire startElement, endElement events.
    118    *
    119    * @param eventType One of the EVENTTYPE_XXX constants.
    120    * @param name The name of the element.
    121    * @param atts The SAX attribute list.
    122    */
    123   public void fireGenerateEvent(int eventType, String name, Attributes atts);
    124 
    125   /**
    126    * Fire characters, cdata events.
    127    *
    128    * @param eventType One of the EVENTTYPE_XXX constants.
    129    * @param ch The char array from the SAX event.
    130    * @param start The start offset to be used in the char array.
    131    * @param length The end offset to be used in the chara array.
    132    */
    133   public void fireGenerateEvent(int eventType, char ch[], int start, int length);
    134 
    135   /**
    136    * Fire processingInstruction events.
    137    *
    138    * @param eventType One of the EVENTTYPE_XXX constants.
    139    * @param name The name of the processing instruction.
    140    * @param data The processing instruction data.
    141    */
    142   public void fireGenerateEvent(int eventType, String name, String data);
    143 
    144 
    145   /**
    146    * Fire comment and entity ref events.
    147    *
    148    * @param eventType One of the EVENTTYPE_XXX constants.
    149    * @param data The comment or entity ref data.
    150    */
    151   public void fireGenerateEvent(int eventType, String data);
    152 
    153 }
    154