001: /*
002: * Copyright 1999-2004 The Apache Software Foundation.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: /*
017: * $Id: SerializerTrace.java,v 1.3 2004/10/14 21:45:05 minchau Exp $
018: */
019: package org.apache.xml.serializer;
020:
021: import org.xml.sax.Attributes;
022:
023: /**
024: * This interface defines a set of integer constants that identify trace event
025: * types.
026: *
027: * @xsl.usage internal
028: */
029:
030: public interface SerializerTrace {
031:
032: /**
033: * Event type generated when a document begins.
034: *
035: */
036: public static final int EVENTTYPE_STARTDOCUMENT = 1;
037:
038: /**
039: * Event type generated when a document ends.
040: */
041: public static final int EVENTTYPE_ENDDOCUMENT = 2;
042:
043: /**
044: * Event type generated when an element begins (after the attributes have been processed but before the children have been added).
045: */
046: public static final int EVENTTYPE_STARTELEMENT = 3;
047:
048: /**
049: * Event type generated when an element ends, after it's children have been added.
050: */
051: public static final int EVENTTYPE_ENDELEMENT = 4;
052:
053: /**
054: * Event type generated for character data (CDATA and Ignorable Whitespace have their own events).
055: */
056: public static final int EVENTTYPE_CHARACTERS = 5;
057:
058: /**
059: * Event type generated for ignorable whitespace (I'm not sure how much this is actually called.
060: */
061: public static final int EVENTTYPE_IGNORABLEWHITESPACE = 6;
062:
063: /**
064: * Event type generated for processing instructions.
065: */
066: public static final int EVENTTYPE_PI = 7;
067:
068: /**
069: * Event type generated after a comment has been added.
070: */
071: public static final int EVENTTYPE_COMMENT = 8;
072:
073: /**
074: * Event type generate after an entity ref is created.
075: */
076: public static final int EVENTTYPE_ENTITYREF = 9;
077:
078: /**
079: * Event type generated after CDATA is generated.
080: */
081: public static final int EVENTTYPE_CDATA = 10;
082:
083: /**
084: * Event type generated when characters might be written to an output stream,
085: * but these characters never are. They will ultimately be written out via
086: * EVENTTYPE_OUTPUT_CHARACTERS. This type is used as attributes are collected.
087: * Whenever the attributes change this event type is fired. At the very end
088: * however, when the attributes do not change anymore and are going to be
089: * ouput to the document the real characters will be written out using the
090: * EVENTTYPE_OUTPUT_CHARACTERS.
091: */
092: public static final int EVENTTYPE_OUTPUT_PSEUDO_CHARACTERS = 11;
093:
094: /**
095: * Event type generated when characters are written to an output stream.
096: */
097: public static final int EVENTTYPE_OUTPUT_CHARACTERS = 12;
098:
099: /**
100: * Tell if trace listeners are present.
101: *
102: * @return True if there are trace listeners
103: */
104: public boolean hasTraceListeners();
105:
106: /**
107: * Fire startDocument, endDocument events.
108: *
109: * @param eventType One of the EVENTTYPE_XXX constants.
110: */
111: public void fireGenerateEvent(int eventType);
112:
113: /**
114: * Fire startElement, endElement events.
115: *
116: * @param eventType One of the EVENTTYPE_XXX constants.
117: * @param name The name of the element.
118: * @param atts The SAX attribute list.
119: */
120: public void fireGenerateEvent(int eventType, String name,
121: Attributes atts);
122:
123: /**
124: * Fire characters, cdata events.
125: *
126: * @param eventType One of the EVENTTYPE_XXX constants.
127: * @param ch The char array from the SAX event.
128: * @param start The start offset to be used in the char array.
129: * @param length The end offset to be used in the chara array.
130: */
131: public void fireGenerateEvent(int eventType, char ch[], int start,
132: int length);
133:
134: /**
135: * Fire processingInstruction events.
136: *
137: * @param eventType One of the EVENTTYPE_XXX constants.
138: * @param name The name of the processing instruction.
139: * @param data The processing instruction data.
140: */
141: public void fireGenerateEvent(int eventType, String name,
142: String data);
143:
144: /**
145: * Fire comment and entity ref events.
146: *
147: * @param eventType One of the EVENTTYPE_XXX constants.
148: * @param data The comment or entity ref data.
149: */
150: public void fireGenerateEvent(int eventType, String data);
151:
152: }
|