KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javolution > xml > sax > DefaultHandler


1 /*
2  * Javolution - Java(TM) Solution for Real-Time and Embedded Systems
3  * Copyright (C) 2006 - Javolution (http://javolution.org/)
4  * All rights reserved.
5  *
6  * Permission to use, copy, modify, and distribute this software is
7  * freely granted, provided that this notice is preserved.
8  */

9 package javolution.xml.sax;
10 import javolution.text.CharArray;
11 import j2me.lang.UnsupportedOperationException;
12 import org.xml.sax.ErrorHandler JavaDoc;
13 import org.xml.sax.Locator JavaDoc;
14 import org.xml.sax.SAXException JavaDoc;
15 import org.xml.sax.SAXParseException JavaDoc;
16
17 /**
18  * Default base class for real-time handling of XML events.
19  *
20  * @author <a HREF="mailto:sax@megginson.com">David Megginson</a>
21  * @author <a HREF="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
22  * @version 3.1, March 11, 2005
23  */

24 public class DefaultHandler implements ContentHandler, ErrorHandler JavaDoc {
25
26     /**
27      * Receives notification of a warning. The default behaviour is to take no
28      * action.
29      *
30      * @param e the warning information encapsulated in a SAX parse exception.
31      * @throws org.xml.sax.SAXException any SAX exception.
32      */

33     public void warning (SAXParseException JavaDoc e) throws SAXException JavaDoc {}
34
35     /**
36      * Receives notification of recoverable parser error. The default behaviour
37      * is to take no action.
38      *
39      * @param e the error information encapsulated in a SAX parse exception.
40      * @throws org.xml.sax.SAXException any SAX exception.
41      */

42     public void error (SAXParseException JavaDoc e) throws SAXException JavaDoc {}
43
44     /**
45      * Reports a fatal XML parsing error. The default behaviour is to throw
46      * the specified exception.
47      *
48      * @param e the error information encapsulated in a SAX parse exception.
49      * @throws org.xml.sax.SAXException any SAX exception.
50      */

51     public void fatalError (SAXParseException JavaDoc e) throws SAXException JavaDoc {
52     throw e;
53     }
54
55     // Implements ContentHandler
56
public void setDocumentLocator(Locator JavaDoc locator) {}
57
58     // Implements ContentHandler
59
public void startDocument() throws SAXException JavaDoc {}
60
61     // Implements ContentHandler
62
public void endDocument() throws SAXException JavaDoc {}
63
64     // Implements ContentHandler
65
public void startPrefixMapping(CharArray prefix, CharArray uri)
66         throws SAXException JavaDoc {}
67
68     // Implements ContentHandler
69
public void endPrefixMapping(CharArray prefix) throws SAXException JavaDoc {}
70
71     // Implements ContentHandler
72
public void startElement(CharArray namespaceURI, CharArray localName,
73         CharArray qName, Attributes atts) throws SAXException JavaDoc {}
74
75     // Implements ContentHandler
76
public void endElement(CharArray namespaceURI, CharArray localName,
77         CharArray qName) throws SAXException JavaDoc {}
78
79     // Implements ContentHandler
80
public void characters(char ch[], int start, int length)
81         throws SAXException JavaDoc {}
82
83     // Implements ContentHandler
84
public void ignorableWhitespace(char ch[], int start, int length)
85         throws SAXException JavaDoc {}
86
87     // Implements ContentHandler
88
public void processingInstruction(CharArray target, CharArray data)
89         throws SAXException JavaDoc {}
90
91     // Implements ContentHandler
92
public void skippedEntity(CharArray name) throws SAXException JavaDoc {}
93
94     /**
95      * <b> Generates compile-time error if <code>startElement</code> is not
96      * correctly overriden. This method generates a compile-error
97      * <code>"final method cannot be overridden"</code> if
98      * <code>org.xml.sax.Attributes</code> is used instead of
99      * <code>javolution.xml.sax.Attributes</code> (common mistake).</b>
100      * @param uri the namespace URI, or an empty character sequence if the
101      * element has no Namespace URI or if namespace processing is not
102      * being performed.
103      * @param localName the local name (without prefix), or an empty character
104      * sequence if namespace processing is not being performed.
105      * @param qName the qualified name (with prefix), or an empty character
106      * sequence if qualified names are not available.
107      * @param atts the attributes attached to the element. If there are no
108      * attributes, it shall be an empty {@link Attributes} object.
109      * @throws org.xml.sax.SAXException any SAX exception.
110      */

111     protected final void startElement(
112         CharArray uri, CharArray localName,
113         CharArray qName, org.xml.sax.Attributes JavaDoc atts) throws SAXException JavaDoc {
114             throw new UnsupportedOperationException JavaDoc();
115     }
116
117 }
Popular Tags