Guys!!! Help me out in this!!!

Subject: Guys!!! Help me out in this!!!
From: Bansi Giri <bansi97@xxxxxxxxx>
Date: Tue, 14 Nov 2000 19:48:18 -0800 (PST)
  I tried to run this program (Source: JavaWorld,
Programming XML in Java, Author: Mark Johnson, using the latest IBM XML4J
(implementation of SAX 2.0), by making the necessary
changes since the example one was based on SAX1.0.
While i am able to run the pgm using SAX 1.0, i am not
able to get any output if i use SAX 2.0. Please help
me out.

Here are the programs:



import org.xml.sax.SAXException;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.InputSource;

import org.xml.sax.helpers.DefaultHandler;

import org.apache.xerces.parsers.SAXParser;

public class TitleFinder extends DefaultHandler {

	private boolean _isTitle = false;

public TitleFinder() {


public void startElement(String element,Attributes
atts) {

	if (element.equals("TITLE")) {
			_isTitle = true;



public void endElement(String element,Attributes atts)
	if (element.equals("TITLE")) {
		_isTitle = false;



public void characters(char[] ch, int start, int
length) {

	if (_isTitle) {

			String sTitle = new String(ch,start,length);
			System.out.println("Title: "+ sTitle);



public static void main(String[] args) {

	if (args.length !=1) {
	System.out.println("Usage: java TitleFinder


	// Creating the parser

	TitleFinder titleFinder = new TitleFinder();

	try {

	SAXParser parser = new SAXParser();
	parser.parse(new InputSource(args[0]));

	} catch (SAXException se) {


		} catch (IOException ie) {



	} // Main method

} // Title Finder Class


<?xml version="1.0"?>


<AUTHOR>Ogden Nash</AUTHOR> 



<LINE>Had 'em.</LINE> 



Thanks in advance

Do You Yahoo!?
Yahoo! Calendar - Get organized for the holidays!

 XSL-List info and archive:

Current Thread