KickJava   Java API By Example, From Geeks To Geeks.

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


1 package net.sf.saxon.trace;
2
3 import net.sf.saxon.style.StandardNames;
4
5 /**
6  * A Simple trace listener for XQuery that writes messages (by default) to System.err
7  */

8
9 public class XQueryTraceListener extends AbstractTraceListener {
10
11     /**
12      * Generate attributes to be included in the opening trace element
13      */

14
15     protected String JavaDoc getOpeningAttributes() {
16         return "";
17     }
18
19     /**
20      * Get the trace element tagname to be used for a particular construct. Return null for
21      * trace events that are ignored by this trace listener.
22      */

23
24     protected String JavaDoc tag(int construct) {
25         switch (construct) {
26             case StandardNames.XSL_FUNCTION:
27                 return "function";
28             case StandardNames.XSL_VARIABLE:
29                 return "variable";
30             case StandardNames.XSL_ELEMENT:
31                 return "element";
32             case StandardNames.XSL_ATTRIBUTE:
33                 return "attribute";
34             case StandardNames.XSL_COMMENT:
35                 return "comment";
36             case StandardNames.XSL_DOCUMENT:
37                 return "document";
38             case StandardNames.XSL_PROCESSING_INSTRUCTION:
39                 return "processing-instruction";
40             case StandardNames.XSL_TEXT:
41                 return "text";
42             case StandardNames.XSL_NAMESPACE:
43                 return "namespace";
44             case Location.LITERAL_RESULT_ELEMENT:
45                 return "element";
46             case Location.LITERAL_RESULT_ATTRIBUTE:
47                 return "attribute";
48             case Location.FUNCTION_CALL:
49                 //return "function-call";
50
return null;
51             case Location.FOR_EXPRESSION:
52                 return "for";
53             case Location.LET_EXPRESSION:
54                 return "let";
55             case Location.WHERE_CLAUSE:
56                 return "where";
57             case Location.ORDER_BY_CLAUSE:
58                 return "sort";
59             case Location.RETURN_EXPRESSION:
60                 return "return";
61             case Location.TYPESWITCH_EXPRESSION:
62                 return "typeswitch";
63             case Location.VALIDATE_EXPRESSION:
64                 return "validate";
65             case Location.IF_EXPRESSION:
66                 return "if";
67             case Location.THEN_EXPRESSION:
68                 return "then";
69             case Location.ELSE_EXPRESSION:
70                 return "else";
71             case Location.CASE_EXPRESSION:
72                 return "case";
73             case Location.DEFAULT_EXPRESSION:
74                 return "default";
75             case Location.TRACE_CALL:
76                 return "user-trace";
77             default:
78                 //return "Other";
79
return null;
80             }
81     }
82
83 }
84
85
86 //
87
// The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
88
// you may not use this file except in compliance with the License. You may obtain a copy of the
89
// License at http://www.mozilla.org/MPL/
90
//
91
// Software distributed under the License is distributed on an "AS IS" basis,
92
// WITHOUT WARRANTY OF ANY KIND, either express or implied.
93
// See the License for the specific language governing rights and limitations under the License.
94
//
95
// The Original Code is: all this file.
96
//
97
// The Initial Developer of the Original Code is Michael H. Kay
98
//
99
// Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
100
//
101
// Contributor(s): none
102
//
Popular Tags