View Javadoc

1   /*
2   
3       stax  Stack API for XML.
4       Copyright (c) 2001-2006 held jointly by the individual authors.
5   
6       This library is free software; you can redistribute it and/or modify it
7       under the terms of the GNU Lesser General Public License as published
8       by the Free Software Foundation; either version 2.1 of the License, or (at
9       your option) any later version.
10  
11      This library is distributed in the hope that it will be useful, but WITHOUT
12      ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or
13      FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14      License for more details.
15  
16      You should have received a copy of the GNU Lesser General Public License
17      along with this library;  if not, write to the Free Software Foundation,
18      Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA.
19  
20      > http://www.gnu.org/copyleft/lesser.html
21      > http://www.opensource.org/licenses/lgpl-license.php
22  
23  */
24  package net.sf.stax;
25  
26  import org.xml.sax.Locator;
27  import org.xml.sax.Attributes;
28  import org.xml.sax.SAXException;
29  
30  /***
31   * Simple implementation of the <code>StAXContentHandler</code>
32   * interface, with empty implementations for all the methods.
33   *
34   * <p>
35   * This class is provided as a base for content handlers where
36   * the implementor does not wish to provide all the methods.
37   * </p>
38   *
39   * @author  Thomas Down
40   * @author  Michael Heuer
41   * @version $Revision: 1.3 $ $Date: 2006/01/02 20:37:34 $
42   */
43  public class StAXContentHandlerBase
44      implements StAXContentHandler
45  {
46  
47      /*** @see StAXContentHandler */
48      public void startTree(final StAXContext ctx)
49          throws SAXException
50      {
51          // empty
52      }
53  
54      /*** @see StAXContentHandler */
55      public Object endTree(final StAXContext ctx)
56          throws SAXException
57      {
58          return null;
59      }
60  
61      /*** @see StAXContentHandler */
62      public void characters(final char[] ch,
63                             final int start,
64                             final int length,
65                             final StAXContext ctx)
66          throws SAXException
67      {
68          // empty
69      }
70  
71      /*** @see StAXContentHandler */
72      public void ignorableWhitespace(final char[] ch,
73                                      final int start,
74                                      final int length,
75                                      final StAXContext ctx)
76          throws SAXException
77      {
78          // empty
79      }
80  
81      /*** @see StAXContentHandler */
82      public void startPrefixMapping(final String prefix,
83                                     final String uri,
84                                     final StAXContext ctx)
85          throws SAXException
86      {
87          // empty
88      }
89  
90      /*** @see StAXContentHandler */
91      public void endPrefixMapping(final String prefix,
92                                   final StAXContext ctx)
93          throws SAXException
94      {
95          // empty
96      }
97  
98      /*** @see StAXContentHandler */
99      public void processingInstruction(final String target,
100                                       final String data,
101                                       final StAXContext ctx)
102         throws SAXException
103     {
104         // empty
105     }
106 
107     /*** @see StAXContentHandler */
108     public void setDocumentLocator(final Locator locator,
109                                    final StAXContext ctx)
110     {
111         ctx.setLocator(locator);
112     }
113 
114     /*** @see StAXContentHandler */
115     public void skippedEntity(final String name,
116                               final StAXContext ctx)
117         throws SAXException
118     {
119         // empty
120     }
121 
122     /*** @see StAXContentHandler */
123     public void startElement(final String nsURI,
124                              final String localName,
125                              final String qName,
126                              final Attributes attrs,
127                              final StAXDelegationContext dctx)
128         throws SAXException
129     {
130         // empty
131     }
132 
133     /*** @see StAXContentHandler */
134     public void endElement(final String nsURI,
135                            final String localName,
136                            final String qName,
137                            final Object result,
138                            final StAXContext ctx)
139         throws SAXException
140     {
141         // empty
142     }
143 }