View Javadoc

1   package net.sf.tomp.xtcl.filter;
2   
3   import org.apache.commons.logging.Log;
4   import org.apache.commons.logging.LogFactory;
5   import org.xml.sax.SAXException;
6   import org.xml.sax.XMLFilter;
7   import org.xml.sax.XMLReader;
8   
9   import java.util.List;
10  
11  /***
12   * A trial MultiFilter for testing purposes.
13   * 
14   * @author tomp
15   */
16  public class MyMultiFilter extends DynamicMultiFilterImpl {
17      private Log log = LogFactory.getLog(MyMultiFilter.class);
18  
19      ////////////////////////////////////////////////////////////////////
20      // Constructors.
21      ////////////////////////////////////////////////////////////////////
22      public MyMultiFilter() throws SAXException {
23          super();
24          setupFilters();
25      }
26  
27      /***
28       * Creates a new MyMultiFilter object.
29       * 
30       * @param parent DOCUMENT ME!
31       * @throws SAXException DOCUMENT ME!
32       */
33      public MyMultiFilter(XMLReader parent) throws SAXException {
34          super(parent);
35          setupFilters();
36      }
37  
38      /***
39       * DOCUMENT ME!
40       * 
41       * @throws SAXException DOCUMENT ME!
42       */
43      protected void setupFilters() throws SAXException {
44          XMLFilter f1 = new org.xml.sax.helpers.XMLFilterImpl();
45  
46          addFilter(0, f1); // the first
47          log.debug("+++ added at 0 " + f1);
48  
49          XMLFilter f2 = new net.sf.tomp.xtcl.filter.XTFilterImpl();
50  
51          addFilter(0, f2); // at begin
52          log.debug("+++ added at 0 " + f2);
53  
54          XMLFilter f3 = new net.sf.tomp.xtcl.filter.XTFilterImpl();
55  
56          addFilter(2, f3); // at end
57          log.debug("+++ added at 2 " + f3);
58          log.debug("+++ filters: " + getFilters());
59  
60          /*
61           * System.out.println("+++ firstfilter: "+firstFilter);
62           * System.out.println("+++ lastfilter: "+lastFilter);
63           * System.out.println("+++ lastfilter.parent=:
64           * "+lastFilter.getParent()); System.out.println("+++
65           * secondfilter.parent=: "+getFilter(1).getParent());
66           * System.out.println("+++ firstfilter.parent=:
67           * "+firstFilter.getParent());
68           */
69      }
70  
71      /***
72       * DOCUMENT ME!
73       * 
74       * @return DOCUMENT ME!
75       */
76      public List getFilters() {
77          return filters;
78      }
79  }
80  
81  /*
82   * The contents of this file are subject to the Mozilla Public License Version
83   * 1.1 (the "License"); you may not use this file except in compliance with the
84   * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
85   * Software distributed under the License is distributed on an "AS IS" basis,
86   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
87   * the specific language governing rights and limitations under the License. The
88   * Original Code is: all this file. The Initial Developer of the Original Code
89   * is: Tomas Pitner, Masaryk University in Brno, Czech Republic. Contributor(s):
90   */