| career | drupal | java | mac | mysql | perl | scala | uml | unix  

Java example source code file (

This example Java source code file ( is included in the "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Learn more about this Java project at its project page.

Java - Java tags/keywords

attributes, contenthandler, defaulthandler, sax, saxexception, string, xmlhandler

The Java example source code

 *   Copyright (c) Rich Hickey. All rights reserved.
 *   The use and distribution terms for this software are covered by the
 *   Eclipse Public License 1.0 (
 *   which can be found in the file epl-v10.html at the root of this distribution.
 *   By using this software in any fashion, you are agreeing to be bound by
 * 	 the terms of this license.
 *   You must not remove this notice, or any other, from this software.

/* rich Dec 17, 2007 */

package clojure.lang;

import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.Locator;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

public class XMLHandler extends DefaultHandler{
ContentHandler h;

public XMLHandler(ContentHandler h){
	this.h = h;

public void setDocumentLocator(Locator locator){

public void startDocument() throws SAXException{

public void endDocument() throws SAXException{

public void startPrefixMapping(String prefix, String uri) throws SAXException{
	h.startPrefixMapping(prefix, uri);

public void endPrefixMapping(String prefix) throws SAXException{

public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException{
	h.startElement(uri, localName, qName, atts);

public void endElement(String uri, String localName, String qName) throws SAXException{
	h.endElement(uri, localName, qName);

public void characters(char ch[], int start, int length) throws SAXException{
	h.characters(ch, start, length);

public void ignorableWhitespace(char ch[], int start, int length) throws SAXException{
	h.ignorableWhitespace(ch, start, length);

public void processingInstruction(String target, String data) throws SAXException{
	h.processingInstruction(target, data);

public void skippedEntity(String name) throws SAXException{

public static void main(String[] args){
		ContentHandler dummy = new DefaultHandler();
		SAXParserFactory f =  SAXParserFactory.newInstance();
		SAXParser p = f.newSAXParser();
		p.parse("",new XMLHandler(dummy));
	catch(Exception e)

Other Java examples (source code examples)

Here is a short list of links related to this Java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller


new blog posts


Copyright 1998-2021 Alvin Alexander,
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.