KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > saxon > trace > TraceListener


1 package net.sf.saxon.trace;
2 import net.sf.saxon.expr.XPathContext;
3 import net.sf.saxon.om.Item;
4
5 import java.util.EventListener JavaDoc;
6
7 /**
8 * This interface defines methods that are called by Saxon during the execution of
9 * a stylesheet, if tracing is switched on. Tracing can be switched on by nominating
10 * an implementation of this class using the TRACE_LISTENER feature of the TransformerFactory,
11 * or using the addTraceListener() method of the Controller, which is Saxon's implementation
12 * of tyhe JAXP javax.xml.transform.Transformer interface.
13 */

14
15 public interface TraceListener extends EventListener JavaDoc {
16
17   /**
18   * Method called at the start of execution, that is, when the run-time transformation starts
19   */

20
21   public void open();
22
23   /**
24   * Method called at the end of execution, that is, when the run-time execution ends
25   */

26
27   public void close();
28
29   /**
30    * Method that is called when an instruction in the stylesheet gets processed.
31    * @param instruction gives information about the instruction being
32    * executed, and about the context in which it is executed. This object is mutable,
33    * so if information from the InstructionInfo is to be retained, it must be copied.
34    */

35
36   public void enter(InstructionInfo instruction, XPathContext context);
37
38   /**
39    * Method that is called after processing an instruction of the stylesheet,
40    * that is, after any child instructions have been processed.
41    * @param instruction gives the same information that was supplied to the
42    * enter method, though it is not necessarily the same object. Note that the
43    * line number of the instruction is that of the start tag in the source stylesheet,
44    * not the line number of the end tag.
45    */

46
47   public void leave(InstructionInfo instruction);
48
49   /**
50    * Method that is called by an instruction that changes the current item
51    * in the source document: that is, xsl:for-each, xsl:apply-templates, xsl:for-each-group.
52    * The method is called after the enter method for the relevant instruction, and is called
53    * once for each item processed.
54    * @param currentItem the new current item. Item objects are not mutable; it is safe to retain
55    * a reference to the Item for later use.
56    */

57
58   public void startCurrentItem(Item currentItem);
59
60   /**
61    * Method that is called when an instruction has finished processing a new current item
62    * and is ready to select a new current item or revert to the previous current item.
63    * The method will be called before the leave() method for the instruction that made this
64    * item current.
65    * @param currentItem the item that was current, whose processing is now complete. This will represent
66    * the same underlying item as the corresponding startCurrentItem() call, though it will
67    * not necessarily be the same actual object.
68    */

69
70   public void endCurrentItem(Item currentItem);
71
72 }
73
74 // Contributor(s):
75
// This module is originally from Edwin Glaser (edwin@pannenleiter.de)
76
// It has since been heavily modified by Michael Kay
77
//
78
Popular Tags