Source Code Cross Referenced for DefaultHandler.java in  » Web-Server » Rimfaxe-Web-Server » org » xml » sax » helpers » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Server » Rimfaxe Web Server » org.xml.sax.helpers 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // DefaultHandler.java - default implementation of the core handlers.
002:        // http://www.saxproject.org
003:        // Written by David Megginson
004:        // NO WARRANTY!  This class is in the public domain.
005:        // $Id: DefaultHandler.java,v 1.7 2002/02/01 20:06:20 db Exp $
006:
007:        package org.xml.sax.helpers;
008:
009:        import java.io.IOException;
010:
011:        import org.xml.sax.InputSource;
012:        import org.xml.sax.Locator;
013:        import org.xml.sax.Attributes;
014:        import org.xml.sax.EntityResolver;
015:        import org.xml.sax.DTDHandler;
016:        import org.xml.sax.ContentHandler;
017:        import org.xml.sax.ErrorHandler;
018:        import org.xml.sax.SAXException;
019:        import org.xml.sax.SAXParseException;
020:
021:        /**
022:         * Default base class for SAX2 event handlers.
023:         *
024:         * <blockquote>
025:         * <em>This module, both source code and documentation, is in the
026:         * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
027:         * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
028:         * for further information.
029:         * </blockquote>
030:         *
031:         * <p>This class is available as a convenience base class for SAX2
032:         * applications: it provides default implementations for all of the
033:         * callbacks in the four core SAX2 handler classes:</p>
034:         *
035:         * <ul>
036:         * <li>{@link org.xml.sax.EntityResolver EntityResolver}</li>
037:         * <li>{@link org.xml.sax.DTDHandler DTDHandler}</li>
038:         * <li>{@link org.xml.sax.ContentHandler ContentHandler}</li>
039:         * <li>{@link org.xml.sax.ErrorHandler ErrorHandler}</li>
040:         * </ul>
041:         *
042:         * <p>Application writers can extend this class when they need to
043:         * implement only part of an interface; parser writers can
044:         * instantiate this class to provide default handlers when the
045:         * application has not supplied its own.</p>
046:         *
047:         * <p>This class replaces the deprecated SAX1
048:         * {@link org.xml.sax.HandlerBase HandlerBase} class.</p>
049:         *
050:         * @since SAX 2.0
051:         * @author David Megginson,
052:         * @version 2.0.1 (sax2r2)
053:         * @see org.xml.sax.EntityResolver
054:         * @see org.xml.sax.DTDHandler
055:         * @see org.xml.sax.ContentHandler
056:         * @see org.xml.sax.ErrorHandler
057:         */
058:        public class DefaultHandler implements  EntityResolver, DTDHandler,
059:                ContentHandler, ErrorHandler {
060:
061:            ////////////////////////////////////////////////////////////////////
062:            // Default implementation of the EntityResolver interface.
063:            ////////////////////////////////////////////////////////////////////
064:
065:            /**
066:             * Resolve an external entity.
067:             *
068:             * <p>Always return null, so that the parser will use the system
069:             * identifier provided in the XML document.  This method implements
070:             * the SAX default behaviour: application writers can override it
071:             * in a subclass to do special translations such as catalog lookups
072:             * or URI redirection.</p>
073:             *
074:             * @param publicId The public identifer, or null if none is
075:             *                 available.
076:             * @param systemId The system identifier provided in the XML 
077:             *                 document.
078:             * @return The new input source, or null to require the
079:             *         default behaviour.
080:             * @exception java.io.IOException If there is an error setting
081:             *            up the new input source.
082:             * @exception org.xml.sax.SAXException Any SAX exception, possibly
083:             *            wrapping another exception.
084:             * @see org.xml.sax.EntityResolver#resolveEntity
085:             */
086:            public InputSource resolveEntity(String publicId, String systemId)
087:                    throws IOException, SAXException {
088:                return null;
089:            }
090:
091:            ////////////////////////////////////////////////////////////////////
092:            // Default implementation of DTDHandler interface.
093:            ////////////////////////////////////////////////////////////////////
094:
095:            /**
096:             * Receive notification of a notation declaration.
097:             *
098:             * <p>By default, do nothing.  Application writers may override this
099:             * method in a subclass if they wish to keep track of the notations
100:             * declared in a document.</p>
101:             *
102:             * @param name The notation name.
103:             * @param publicId The notation public identifier, or null if not
104:             *                 available.
105:             * @param systemId The notation system identifier.
106:             * @exception org.xml.sax.SAXException Any SAX exception, possibly
107:             *            wrapping another exception.
108:             * @see org.xml.sax.DTDHandler#notationDecl
109:             */
110:            public void notationDecl(String name, String publicId,
111:                    String systemId) throws SAXException {
112:                // no op
113:            }
114:
115:            /**
116:             * Receive notification of an unparsed entity declaration.
117:             *
118:             * <p>By default, do nothing.  Application writers may override this
119:             * method in a subclass to keep track of the unparsed entities
120:             * declared in a document.</p>
121:             *
122:             * @param name The entity name.
123:             * @param publicId The entity public identifier, or null if not
124:             *                 available.
125:             * @param systemId The entity system identifier.
126:             * @param notationName The name of the associated notation.
127:             * @exception org.xml.sax.SAXException Any SAX exception, possibly
128:             *            wrapping another exception.
129:             * @see org.xml.sax.DTDHandler#unparsedEntityDecl
130:             */
131:            public void unparsedEntityDecl(String name, String publicId,
132:                    String systemId, String notationName) throws SAXException {
133:                // no op
134:            }
135:
136:            ////////////////////////////////////////////////////////////////////
137:            // Default implementation of ContentHandler interface.
138:            ////////////////////////////////////////////////////////////////////
139:
140:            /**
141:             * Receive a Locator object for document events.
142:             *
143:             * <p>By default, do nothing.  Application writers may override this
144:             * method in a subclass if they wish to store the locator for use
145:             * with other document events.</p>
146:             *
147:             * @param locator A locator for all SAX document events.
148:             * @see org.xml.sax.ContentHandler#setDocumentLocator
149:             * @see org.xml.sax.Locator
150:             */
151:            public void setDocumentLocator(Locator locator) {
152:                // no op
153:            }
154:
155:            /**
156:             * Receive notification of the beginning of the document.
157:             *
158:             * <p>By default, do nothing.  Application writers may override this
159:             * method in a subclass to take specific actions at the beginning
160:             * of a document (such as allocating the root node of a tree or
161:             * creating an output file).</p>
162:             *
163:             * @exception org.xml.sax.SAXException Any SAX exception, possibly
164:             *            wrapping another exception.
165:             * @see org.xml.sax.ContentHandler#startDocument
166:             */
167:            public void startDocument() throws SAXException {
168:                // no op
169:            }
170:
171:            /**
172:             * Receive notification of the end of the document.
173:             *
174:             * <p>By default, do nothing.  Application writers may override this
175:             * method in a subclass to take specific actions at the end
176:             * of a document (such as finalising a tree or closing an output
177:             * file).</p>
178:             *
179:             * @exception org.xml.sax.SAXException Any SAX exception, possibly
180:             *            wrapping another exception.
181:             * @see org.xml.sax.ContentHandler#endDocument
182:             */
183:            public void endDocument() throws SAXException {
184:                // no op
185:            }
186:
187:            /**
188:             * Receive notification of the start of a Namespace mapping.
189:             *
190:             * <p>By default, do nothing.  Application writers may override this
191:             * method in a subclass to take specific actions at the start of
192:             * each Namespace prefix scope (such as storing the prefix mapping).</p>
193:             *
194:             * @param prefix The Namespace prefix being declared.
195:             * @param uri The Namespace URI mapped to the prefix.
196:             * @exception org.xml.sax.SAXException Any SAX exception, possibly
197:             *            wrapping another exception.
198:             * @see org.xml.sax.ContentHandler#startPrefixMapping
199:             */
200:            public void startPrefixMapping(String prefix, String uri)
201:                    throws SAXException {
202:                // no op
203:            }
204:
205:            /**
206:             * Receive notification of the end of a Namespace mapping.
207:             *
208:             * <p>By default, do nothing.  Application writers may override this
209:             * method in a subclass to take specific actions at the end of
210:             * each prefix mapping.</p>
211:             *
212:             * @param prefix The Namespace prefix being declared.
213:             * @exception org.xml.sax.SAXException Any SAX exception, possibly
214:             *            wrapping another exception.
215:             * @see org.xml.sax.ContentHandler#endPrefixMapping
216:             */
217:            public void endPrefixMapping(String prefix) throws SAXException {
218:                // no op
219:            }
220:
221:            /**
222:             * Receive notification of the start of an element.
223:             *
224:             * <p>By default, do nothing.  Application writers may override this
225:             * method in a subclass to take specific actions at the start of
226:             * each element (such as allocating a new tree node or writing
227:             * output to a file).</p>
228:             *
229:             * @param uri The Namespace URI, or the empty string if the
230:             *        element has no Namespace URI or if Namespace
231:             *        processing is not being performed.
232:             * @param localName The local name (without prefix), or the
233:             *        empty string if Namespace processing is not being
234:             *        performed.
235:             * @param qName The qualified name (with prefix), or the
236:             *        empty string if qualified names are not available.
237:             * @param atts The attributes attached to the element.  If
238:             *        there are no attributes, it shall be an empty
239:             *        Attributes object.
240:             * @exception org.xml.sax.SAXException Any SAX exception, possibly
241:             *            wrapping another exception.
242:             * @see org.xml.sax.ContentHandler#startElement
243:             */
244:            public void startElement(String uri, String localName,
245:                    String qName, Attributes attributes) throws SAXException {
246:                // no op
247:            }
248:
249:            /**
250:             * Receive notification of the end of an element.
251:             *
252:             * <p>By default, do nothing.  Application writers may override this
253:             * method in a subclass to take specific actions at the end of
254:             * each element (such as finalising a tree node or writing
255:             * output to a file).</p>
256:             *
257:             * @param uri The Namespace URI, or the empty string if the
258:             *        element has no Namespace URI or if Namespace
259:             *        processing is not being performed.
260:             * @param localName The local name (without prefix), or the
261:             *        empty string if Namespace processing is not being
262:             *        performed.
263:             * @param qName The qualified name (with prefix), or the
264:             *        empty string if qualified names are not available.
265:             * @exception org.xml.sax.SAXException Any SAX exception, possibly
266:             *            wrapping another exception.
267:             * @see org.xml.sax.ContentHandler#endElement
268:             */
269:            public void endElement(String uri, String localName, String qName)
270:                    throws SAXException {
271:                // no op
272:            }
273:
274:            /**
275:             * Receive notification of character data inside an element.
276:             *
277:             * <p>By default, do nothing.  Application writers may override this
278:             * method to take specific actions for each chunk of character data
279:             * (such as adding the data to a node or buffer, or printing it to
280:             * a file).</p>
281:             *
282:             * @param ch The characters.
283:             * @param start The start position in the character array.
284:             * @param length The number of characters to use from the
285:             *               character array.
286:             * @exception org.xml.sax.SAXException Any SAX exception, possibly
287:             *            wrapping another exception.
288:             * @see org.xml.sax.ContentHandler#characters
289:             */
290:            public void characters(char ch[], int start, int length)
291:                    throws SAXException {
292:                // no op
293:            }
294:
295:            /**
296:             * Receive notification of ignorable whitespace in element content.
297:             *
298:             * <p>By default, do nothing.  Application writers may override this
299:             * method to take specific actions for each chunk of ignorable
300:             * whitespace (such as adding data to a node or buffer, or printing
301:             * it to a file).</p>
302:             *
303:             * @param ch The whitespace characters.
304:             * @param start The start position in the character array.
305:             * @param length The number of characters to use from the
306:             *               character array.
307:             * @exception org.xml.sax.SAXException Any SAX exception, possibly
308:             *            wrapping another exception.
309:             * @see org.xml.sax.ContentHandler#ignorableWhitespace
310:             */
311:            public void ignorableWhitespace(char ch[], int start, int length)
312:                    throws SAXException {
313:                // no op
314:            }
315:
316:            /**
317:             * Receive notification of a processing instruction.
318:             *
319:             * <p>By default, do nothing.  Application writers may override this
320:             * method in a subclass to take specific actions for each
321:             * processing instruction, such as setting status variables or
322:             * invoking other methods.</p>
323:             *
324:             * @param target The processing instruction target.
325:             * @param data The processing instruction data, or null if
326:             *             none is supplied.
327:             * @exception org.xml.sax.SAXException Any SAX exception, possibly
328:             *            wrapping another exception.
329:             * @see org.xml.sax.ContentHandler#processingInstruction
330:             */
331:            public void processingInstruction(String target, String data)
332:                    throws SAXException {
333:                // no op
334:            }
335:
336:            /**
337:             * Receive notification of a skipped entity.
338:             *
339:             * <p>By default, do nothing.  Application writers may override this
340:             * method in a subclass to take specific actions for each
341:             * processing instruction, such as setting status variables or
342:             * invoking other methods.</p>
343:             *
344:             * @param name The name of the skipped entity.
345:             * @exception org.xml.sax.SAXException Any SAX exception, possibly
346:             *            wrapping another exception.
347:             * @see org.xml.sax.ContentHandler#processingInstruction
348:             */
349:            public void skippedEntity(String name) throws SAXException {
350:                // no op
351:            }
352:
353:            ////////////////////////////////////////////////////////////////////
354:            // Default implementation of the ErrorHandler interface.
355:            ////////////////////////////////////////////////////////////////////
356:
357:            /**
358:             * Receive notification of a parser warning.
359:             *
360:             * <p>The default implementation does nothing.  Application writers
361:             * may override this method in a subclass to take specific actions
362:             * for each warning, such as inserting the message in a log file or
363:             * printing it to the console.</p>
364:             *
365:             * @param e The warning information encoded as an exception.
366:             * @exception org.xml.sax.SAXException Any SAX exception, possibly
367:             *            wrapping another exception.
368:             * @see org.xml.sax.ErrorHandler#warning
369:             * @see org.xml.sax.SAXParseException
370:             */
371:            public void warning(SAXParseException e) throws SAXException {
372:                // no op
373:            }
374:
375:            /**
376:             * Receive notification of a recoverable parser error.
377:             *
378:             * <p>The default implementation does nothing.  Application writers
379:             * may override this method in a subclass to take specific actions
380:             * for each error, such as inserting the message in a log file or
381:             * printing it to the console.</p>
382:             *
383:             * @param e The warning information encoded as an exception.
384:             * @exception org.xml.sax.SAXException Any SAX exception, possibly
385:             *            wrapping another exception.
386:             * @see org.xml.sax.ErrorHandler#warning
387:             * @see org.xml.sax.SAXParseException
388:             */
389:            public void error(SAXParseException e) throws SAXException {
390:                // no op
391:            }
392:
393:            /**
394:             * Report a fatal XML parsing error.
395:             *
396:             * <p>The default implementation throws a SAXParseException.
397:             * Application writers may override this method in a subclass if
398:             * they need to take specific actions for each fatal error (such as
399:             * collecting all of the errors into a single report): in any case,
400:             * the application must stop all regular processing when this
401:             * method is invoked, since the document is no longer reliable, and
402:             * the parser may no longer report parsing events.</p>
403:             *
404:             * @param e The error information encoded as an exception.
405:             * @exception org.xml.sax.SAXException Any SAX exception, possibly
406:             *            wrapping another exception.
407:             * @see org.xml.sax.ErrorHandler#fatalError
408:             * @see org.xml.sax.SAXParseException
409:             */
410:            public void fatalError(SAXParseException e) throws SAXException {
411:                throw e;
412:            }
413:
414:        }
415:
416:        // end of DefaultHandler.java
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.