KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xalan > trace > GenerateEvent


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: GenerateEvent.java,v 1.11 2004/02/16 23:00:27 minchau Exp $
18  */

19 package org.apache.xalan.trace;
20
21 import org.apache.xalan.transformer.TransformerImpl;
22 import org.xml.sax.Attributes JavaDoc;
23
24 /**
25  * Event generated by the XSL processor after it generates a new node in the result tree.
26  * This event responds to and is modeled on the SAX events that are sent to the
27  * formatter listener FormatterToXXX)classes.
28  *
29  * @see org.apache.xml.utils.DOMBuilder
30  * @see org.apache.xalan.serialize.SerializerToHTML
31  * @see org.apache.xalan.serialize.SerializerToText
32  * @see org.apache.xalan.serialize.SerializerToXML
33  *
34  * @xsl.usage advanced
35  */

36 public class GenerateEvent implements java.util.EventListener JavaDoc
37 {
38
39   /**
40    * The XSLT Transformer, which either directly or indirectly contains most needed information.
41    *
42    * @see org.apache.xalan.transformer.TransformerImpl
43    */

44   public TransformerImpl m_processor;
45
46   /**
47    * The type of SAX event that was generated, as enumerated in the EVENTTYPE_XXX constants below.
48    */

49   public int m_eventtype;
50
51
52   /**
53    * Character data from a character or cdata event.
54    */

55   public char m_characters[];
56
57   /**
58    * The start position of the current data in m_characters.
59    */

60   public int m_start;
61
62   /**
63    * The length of the current data in m_characters.
64    */

65   public int m_length;
66
67   /**
68    * The name of the element or PI.
69    */

70   public String JavaDoc m_name;
71
72   /**
73    * The string data in the element (comments and PIs).
74    */

75   public String JavaDoc m_data;
76
77   /**
78    * The current attribute list.
79    */

80   public Attributes JavaDoc m_atts;
81
82   /**
83    * Constructor for startDocument, endDocument events.
84    *
85    * @param processor The XSLT TransformerFactory instance.
86    * @param eventType One of the EVENTTYPE_XXX constants.
87    */

88   public GenerateEvent(TransformerImpl processor, int eventType)
89   {
90     m_processor = processor;
91     m_eventtype = eventType;
92   }
93
94   /**
95    * Constructor for startElement, endElement events.
96    *
97    * @param processor The XSLT TransformerFactory Instance.
98    * @param eventType One of the EVENTTYPE_XXX constants.
99    * @param name The name of the element.
100    * @param atts The SAX attribute list.
101    */

102   public GenerateEvent(TransformerImpl processor, int eventType, String JavaDoc name,
103                        Attributes JavaDoc atts)
104   {
105
106     m_name = name;
107     m_atts = atts;
108     m_processor = processor;
109     m_eventtype = eventType;
110   }
111
112   /**
113    * Constructor for characters, cdate events.
114    *
115    * @param processor The XSLT TransformerFactory instance.
116    * @param eventType One of the EVENTTYPE_XXX constants.
117    * @param ch The char array from the SAX event.
118    * @param start The start offset to be used in the char array.
119    * @param length The end offset to be used in the chara array.
120    */

121   public GenerateEvent(TransformerImpl processor, int eventType, char ch[],
122                        int start, int length)
123   {
124
125     m_characters = ch;
126     m_start = start;
127     m_length = length;
128     m_processor = processor;
129     m_eventtype = eventType;
130   }
131
132   /**
133    * Constructor for processingInstruction events.
134    *
135    * @param processor The instance of the XSLT processor.
136    * @param eventType One of the EVENTTYPE_XXX constants.
137    * @param name The name of the processing instruction.
138    * @param data The processing instruction data.
139    */

140   public GenerateEvent(TransformerImpl processor, int eventType, String JavaDoc name,
141                        String JavaDoc data)
142   {
143
144     m_name = name;
145     m_data = data;
146     m_processor = processor;
147     m_eventtype = eventType;
148   }
149
150   /**
151    * Constructor for comment and entity ref events.
152    *
153    * @param processor The XSLT processor instance.
154    * @param eventType One of the EVENTTYPE_XXX constants.
155    * @param data The comment or entity ref data.
156    */

157   public GenerateEvent(TransformerImpl processor, int eventType, String JavaDoc data)
158   {
159
160     m_data = data;
161     m_processor = processor;
162     m_eventtype = eventType;
163   }
164 }
165
Popular Tags