001: /*
002: * Javolution - Java(TM) Solution for Real-Time and Embedded Systems
003: * Copyright (C) 2006 - Javolution (http://javolution.org/)
004: * All rights reserved.
005: *
006: * Permission to use, copy, modify, and distribute this software is
007: * freely granted, provided that this notice is preserved.
008: */
009: package javolution.xml.sax;
010:
011: import javolution.text.CharArray;
012: import j2me.lang.UnsupportedOperationException;
013: import org.xml.sax.ErrorHandler;
014: import org.xml.sax.Locator;
015: import org.xml.sax.SAXException;
016: import org.xml.sax.SAXParseException;
017:
018: /**
019: * Default base class for real-time handling of XML events.
020: *
021: * @author <a href="mailto:sax@megginson.com">David Megginson</a>
022: * @author <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
023: * @version 3.1, March 11, 2005
024: */
025: public class DefaultHandler implements ContentHandler, ErrorHandler {
026:
027: /**
028: * Receives notification of a warning. The default behaviour is to take no
029: * action.
030: *
031: * @param e the warning information encapsulated in a SAX parse exception.
032: * @throws org.xml.sax.SAXException any SAX exception.
033: */
034: public void warning(SAXParseException e) throws SAXException {
035: }
036:
037: /**
038: * Receives notification of recoverable parser error. The default behaviour
039: * is to take no action.
040: *
041: * @param e the error information encapsulated in a SAX parse exception.
042: * @throws org.xml.sax.SAXException any SAX exception.
043: */
044: public void error(SAXParseException e) throws SAXException {
045: }
046:
047: /**
048: * Reports a fatal XML parsing error. The default behaviour is to throw
049: * the specified exception.
050: *
051: * @param e the error information encapsulated in a SAX parse exception.
052: * @throws org.xml.sax.SAXException any SAX exception.
053: */
054: public void fatalError(SAXParseException e) throws SAXException {
055: throw e;
056: }
057:
058: // Implements ContentHandler
059: public void setDocumentLocator(Locator locator) {
060: }
061:
062: // Implements ContentHandler
063: public void startDocument() throws SAXException {
064: }
065:
066: // Implements ContentHandler
067: public void endDocument() throws SAXException {
068: }
069:
070: // Implements ContentHandler
071: public void startPrefixMapping(CharArray prefix, CharArray uri)
072: throws SAXException {
073: }
074:
075: // Implements ContentHandler
076: public void endPrefixMapping(CharArray prefix) throws SAXException {
077: }
078:
079: // Implements ContentHandler
080: public void startElement(CharArray namespaceURI,
081: CharArray localName, CharArray qName, Attributes atts)
082: throws SAXException {
083: }
084:
085: // Implements ContentHandler
086: public void endElement(CharArray namespaceURI, CharArray localName,
087: CharArray qName) throws SAXException {
088: }
089:
090: // Implements ContentHandler
091: public void characters(char ch[], int start, int length)
092: throws SAXException {
093: }
094:
095: // Implements ContentHandler
096: public void ignorableWhitespace(char ch[], int start, int length)
097: throws SAXException {
098: }
099:
100: // Implements ContentHandler
101: public void processingInstruction(CharArray target, CharArray data)
102: throws SAXException {
103: }
104:
105: // Implements ContentHandler
106: public void skippedEntity(CharArray name) throws SAXException {
107: }
108:
109: /**
110: * <b> Generates compile-time error if <code>startElement</code> is not
111: * correctly overriden. This method generates a compile-error
112: * <code>"final method cannot be overridden"</code> if
113: * <code>org.xml.sax.Attributes</code> is used instead of
114: * <code>javolution.xml.sax.Attributes</code> (common mistake).</b>
115: * @param uri the namespace URI, or an empty character sequence if the
116: * element has no Namespace URI or if namespace processing is not
117: * being performed.
118: * @param localName the local name (without prefix), or an empty character
119: * sequence if namespace processing is not being performed.
120: * @param qName the qualified name (with prefix), or an empty character
121: * sequence if qualified names are not available.
122: * @param atts the attributes attached to the element. If there are no
123: * attributes, it shall be an empty {@link Attributes} object.
124: * @throws org.xml.sax.SAXException any SAX exception.
125: */
126: protected final void startElement(CharArray uri,
127: CharArray localName, CharArray qName,
128: org.xml.sax.Attributes atts) throws SAXException {
129: throw new UnsupportedOperationException();
130: }
131:
132: }
|