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