View Javadoc

1   package net.sf.tomp.xtcl.test;
2   
3   import net.sf.tomp.xtcl.filter.XTFilterImpl;
4   
5   import org.xml.sax.Attributes;
6   import org.xml.sax.SAXException;
7   
8   /***
9    * A trace XTFilter -- prints SAX events on stdout
10   * 
11   * @author tomp
12   */
13  public class PokusXTFilter extends XTFilterImpl {
14      /***
15       * DOCUMENT ME!
16       * 
17       * @throws SAXException DOCUMENT ME!
18       */
19      public void startDocument() throws SAXException {
20          System.out.println("!!!" + this + ".startDocument");
21  
22          //startDTD("graph", "graph-public", "graph.dtd");
23          super.startDocument();
24      }
25  
26      /***
27       * DOCUMENT ME!
28       * 
29       * @throws SAXException DOCUMENT ME!
30       */
31      public void endDocument() throws SAXException {
32          System.out.println("!!!" + this + ".endDocument");
33          super.endDocument();
34      }
35  
36      /***
37       * DOCUMENT ME!
38       * 
39       * @param prefix DOCUMENT ME!
40       * @param uri DOCUMENT ME!
41       * @throws SAXException DOCUMENT ME!
42       */
43      public void startPrefixMapping(String prefix, String uri)
44              throws SAXException {
45          System.out.println("!!!" + this + ".startPrefixMapping " + prefix + "="
46                  + uri);
47          super.startPrefixMapping(prefix, uri);
48      }
49  
50      /***
51       * DOCUMENT ME!
52       * 
53       * @param prefix DOCUMENT ME!
54       * @throws SAXException DOCUMENT ME!
55       */
56      public void endPrefixMapping(String prefix) throws SAXException {
57          System.out.println("!!!" + this + ".endPrefixMapping " + prefix);
58          super.endPrefixMapping(prefix);
59      }
60  
61      /***
62       * Filter a start element event.
63       * 
64       * @param uri The element's Namespace URI, or the empty string.
65       * @param localName The element's local name, or the empty string.
66       * @param qName The element's qualified (prefixed) name, or the empty
67       *            string.
68       * @param atts The element's attributes.
69       * @exception SAXException The client may throw an exception during
70       *                processing.
71       */
72      public void startElement(String uri, String localName, String qName,
73              Attributes atts) throws SAXException {
74          System.out.println("!!!" + this + ".startElement localName="+localName);
75          super.startElement(uri, localName, qName, atts);
76      }
77  
78      /***
79       * Filter an end element event.
80       * 
81       * @param uri The element's Namespace URI, or the empty string.
82       * @param localName The element's local name, or the empty string.
83       * @param qName The element's qualified (prefixed) name, or the empty
84       *            string.
85       * @exception SAXException The client may throw an exception during
86       *                processing.
87       */
88      public void endElement(String uri, String localName, String qName)
89              throws SAXException {
90          System.out.println("!!!" + this + ".endElement localName="+localName);
91          super.endElement(uri, localName, qName);
92      }
93  
94      // No-op methods to satisfy lexical handler interface
95      
96      /***
97       * Register the start of the DTD. Comments in the DTD are skipped because
98       * they are not part of the XPath data model
99       * 
100      * @param name DOCUMENT ME!
101      * @param publicId DOCUMENT ME!
102      * @param systemId DOCUMENT ME!
103      * @throws SAXException DOCUMENT ME!
104      */
105     public void startDTD(String name, String publicId, String systemId)
106             throws SAXException {
107         System.out.println("!!!" + this + ".startDTD name="+name+" public="+publicId+" systemId="+systemId);
108         super.startDTD(name, publicId, systemId);
109     }
110 
111     /***
112      * Register the end of the DTD. Comments in the DTD are skipped because they
113      * are not part of the XPath data model
114      * 
115      * @throws SAXException DOCUMENT ME!
116      */
117     public void endDTD() throws SAXException {
118         System.out.println("!!!" + this + ".endDTD");
119         super.endDTD();
120     }
121 
122     /*
123      * public void comment(char[] s, int b, int l) throws SAXException {
124      * System.out.println("!!!"+this+".comment="+new String(s, b, l));
125      * super.comment(s, b, l); }
126      */
127     /*
128      * public void startElement (String uri, String localName, String qName,
129      * Attributes atts) throws SAXException {
130      * System.out.println("!!!"+this+".startElement "+localName);
131      * super.startElement(uri, localName, qName, atts); } public void endElement
132      * (String uri, String localName, String qName) throws SAXException {
133      * System.out.println("!!!"+this+".endElement "+localName);
134      * super.endElement(uri, localName, qName); } public void startDTD (String
135      * name, String publicId, String systemId) throws SAXException {
136      * System.out.println("!!!"+this+".startDTD "+name+" publicId="+publicId+"
137      * systemId="+systemId); super.startDTD(name, publicId, systemId); }
138      */
139 }
140 
141 /*
142  * The contents of this file are subject to the Mozilla Public License Version
143  * 1.1 (the "License"); you may not use this file except in compliance with the
144  * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
145  * Software distributed under the License is distributed on an "AS IS" basis,
146  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
147  * the specific language governing rights and limitations under the License. The
148  * Original Code is: all this file. The Initial Developer of the Original Code
149  * is: Tomas Pitner, Masaryk University in Brno, Czech Republic. Contributor(s):
150  */