KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xml > serializer > SerializerTrace


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 /*
17  * $Id: SerializerTrace.java,v 1.2 2004/02/17 04:18:18 minchau Exp $
18  */

19 package org.apache.xml.serializer;
20
21 import org.xml.sax.Attributes JavaDoc;
22
23 /**
24  * This interface defines a set of integer constants that identify trace event
25  * types.
26  */

27
28 public interface SerializerTrace {
29     
30   /**
31    * Event type generated when a document begins.
32    *
33    */

34   public static final int EVENTTYPE_STARTDOCUMENT = 1;
35
36   /**
37    * Event type generated when a document ends.
38    */

39   public static final int EVENTTYPE_ENDDOCUMENT = 2;
40
41   /**
42    * Event type generated when an element begins (after the attributes have been processed but before the children have been added).
43    */

44   public static final int EVENTTYPE_STARTELEMENT = 3;
45
46   /**
47    * Event type generated when an element ends, after it's children have been added.
48    */

49   public static final int EVENTTYPE_ENDELEMENT = 4;
50
51   /**
52    * Event type generated for character data (CDATA and Ignorable Whitespace have their own events).
53    */

54   public static final int EVENTTYPE_CHARACTERS = 5;
55
56   /**
57    * Event type generated for ignorable whitespace (I'm not sure how much this is actually called.
58    */

59   public static final int EVENTTYPE_IGNORABLEWHITESPACE = 6;
60
61   /**
62    * Event type generated for processing instructions.
63    */

64   public static final int EVENTTYPE_PI = 7;
65
66   /**
67    * Event type generated after a comment has been added.
68    */

69   public static final int EVENTTYPE_COMMENT = 8;
70
71   /**
72    * Event type generate after an entity ref is created.
73    */

74   public static final int EVENTTYPE_ENTITYREF = 9;
75
76   /**
77    * Event type generated after CDATA is generated.
78    */

79   public static final int EVENTTYPE_CDATA = 10;
80   
81   /**
82    * Event type generated when characters might be written to an output stream,
83    * but these characters never are. They will ultimately be written out via
84    * EVENTTYPE_OUTPUT_CHARACTERS. This type is used as attributes are collected.
85    * Whenever the attributes change this event type is fired. At the very end
86    * however, when the attributes do not change anymore and are going to be
87    * ouput to the document the real characters will be written out using the
88    * EVENTTYPE_OUTPUT_CHARACTERS.
89    */

90   public static final int EVENTTYPE_OUTPUT_PSEUDO_CHARACTERS = 11;
91   
92   /**
93    * Event type generated when characters are written to an output stream.
94    */

95   public static final int EVENTTYPE_OUTPUT_CHARACTERS = 12;
96     
97
98   /**
99    * Tell if trace listeners are present.
100    *
101    * @return True if there are trace listeners
102    */

103   public boolean hasTraceListeners();
104   
105   /**
106    * Fire startDocument, endDocument events.
107    *
108    * @param eventType One of the EVENTTYPE_XXX constants.
109    */

110   public void fireGenerateEvent(int eventType);
111   
112   /**
113    * Fire startElement, endElement events.
114    *
115    * @param eventType One of the EVENTTYPE_XXX constants.
116    * @param name The name of the element.
117    * @param atts The SAX attribute list.
118    */

119   public void fireGenerateEvent(int eventType, String JavaDoc name, Attributes JavaDoc atts);
120   
121   /**
122    * Fire characters, cdata events.
123    *
124    * @param eventType One of the EVENTTYPE_XXX constants.
125    * @param ch The char array from the SAX event.
126    * @param start The start offset to be used in the char array.
127    * @param length The end offset to be used in the chara array.
128    */

129   public void fireGenerateEvent(int eventType, char ch[], int start, int length);
130   
131   /**
132    * Fire processingInstruction events.
133    *
134    * @param eventType One of the EVENTTYPE_XXX constants.
135    * @param name The name of the processing instruction.
136    * @param data The processing instruction data.
137    */

138   public void fireGenerateEvent(int eventType, String JavaDoc name, String JavaDoc data);
139   
140
141   /**
142    * Fire comment and entity ref events.
143    *
144    * @param eventType One of the EVENTTYPE_XXX constants.
145    * @param data The comment or entity ref data.
146    */

147   public void fireGenerateEvent(int eventType, String JavaDoc data);
148   
149 }
150
Popular Tags