/*
 * Javolution - Java(TM) Solution for Real-Time and Embedded Systems
 * Copyright (C) 2005 - Javolution (http://javolution.org/)
 * All rights reserved.
 * 
 * Permission to use, copy, modify, and distribute this software is
 * freely granted, provided that this notice is preserved.
 */
package javolution37.javolution.xml.sax;
import java.lang.CharSequence;
import java.lang.UnsupportedOperationException;
import org.xml.sax.ErrorHandler;
import org.xml.sax.Locator;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;

/**
 * Default base class for real-time handling of XML events.
 *
 * @author  David Megginson
 * @author  Jean-Marie Dautelle
 * @version 3.1, March 11, 2005
 */
public class DefaultHandler implements ContentHandler, ErrorHandler {

    /**
     * Receives notification of a warning. The default behaviour is to take no
     * action.
     *
     * @param  e the warning information encapsulated in a SAX parse exception.
     * @throws org.xml.sax.SAXException any SAX exception.
     */
    public void warning (SAXParseException e) throws SAXException {}

    /**
     * Receives notification of recoverable parser error. The default behaviour
     * is to take no action.
     *
     * @param  e the error information encapsulated in a SAX parse exception.
     * @throws org.xml.sax.SAXException any SAX exception.
     */
    public void error (SAXParseException e) throws SAXException {}

    /**
     * Reports a fatal XML parsing error. The default behaviour is to throw
     * the specified exception.
     *
     * @param  e the error information encapsulated in a SAX parse exception.
     * @throws org.xml.sax.SAXException any SAX exception.
     */
    public void fatalError (SAXParseException e) throws SAXException {
	throw e;
    }

    // Implements ContentHandler
    public void setDocumentLocator(Locator locator) {}

    // Implements ContentHandler
    public void startDocument() throws SAXException {}

    // Implements ContentHandler
    public void endDocument() throws SAXException {}

    // Implements ContentHandler
    public void startPrefixMapping(CharSequence prefix, CharSequence uri)
        throws SAXException {}

    // Implements ContentHandler
    public void endPrefixMapping(CharSequence prefix) throws SAXException {}

    // Implements ContentHandler
    public void startElement(CharSequence namespaceURI, CharSequence localName,
        CharSequence qName, Attributes atts) throws SAXException {}

    // Implements ContentHandler
    public void endElement(CharSequence namespaceURI, CharSequence localName,
        CharSequence qName) throws SAXException {}

    // Implements ContentHandler
    public void characters(char ch[], int start, int length)
        throws SAXException {}

    // Implements ContentHandler
    public void ignorableWhitespace(char ch[], int start, int length)
        throws SAXException {}

    // Implements ContentHandler
    public void processingInstruction(CharSequence target, CharSequence data)
        throws SAXException {}

    // Implements ContentHandler
    public void skippedEntity(CharSequence name) throws SAXException {}

    /**
     *  Generates compile-time error if startElement is not
     *     correctly overriden.  This method generates a compile-error
     *     "final method cannot be overridden" if
     *     org.xml.sax.Attributes is used instead of
     *     javolution.xml.sax.Attributes (common mistake).
     * @param  uri the namespace URI, or an empty character sequence if the
     *         element has no Namespace URI or if namespace processing is not
     *         being performed.
     * @param  localName the local name (without prefix), or an empty character
     *         sequence if namespace processing is not being performed.
     * @param  qName the qualified name (with prefix), or an empty character
     *         sequence if qualified names are not available.
     * @param  atts the attributes attached to the element.  If there are no
     *         attributes, it shall be an empty {@link Attributes} object.
     * @throws org.xml.sax.SAXException any SAX exception.
     */
    protected final void startElement(
        CharSequence uri, CharSequence localName,
        CharSequence qName, org.xml.sax.Attributes atts) throws SAXException {
            throw new UnsupportedOperationException();
    }

}
 

Ads help maintain this website.