Source Code Cross Referenced for DefaultHandler.java in  » 6.0-JDK-Modules » j2me » 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 » 6.0 JDK Modules » j2me » org.xml.sax.helpers 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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