is not abstract and does not override abstract method ERROR

Hello. I'm new at all this, and am attempting to recreate a sample code out of my book (Teach Yourself XML in 24 Hours), and I keep getting an error. I appriciate any help.

This is the Error that I get:

DocumentPrinter is notabstract and does not overrideabstract method skippedEntity(java.lang.String) in org.xml.sax.ContentHandler

publicclass DocumentPrinterimplements ContentHandler, ErrorHandler

^

This is the sourcecode:

import org.xml.sax.Attributes;

import org.xml.sax.ContentHandler;

import org.xml.sax.ErrorHandler;

import org.xml.sax.Locator;

import org.xml.sax.SAXParseException;

import org.xml.sax.XMLReader;

publicclass DocumentPrinterimplements ContentHandler, ErrorHandler

{

// A Constant containing the name of the SAX parser to use.

privatestaticfinal String PARSER_NAME ="org.apache.xerces.parsers.SAXParser";

publicstaticvoid main(String[] args)

{

// Check to see whether the user supplied any command line arguments. If not, print an error and exit.

if (args.length == 0)

{

System.out.println("No XML document path specified.");

System.exit(1);

}

// Create a new instance of the DocumentPrinter class.

DocumentPrinter dp =new DocumentPrinter();

try

{

// Create a new instance of the XML Parser.

XMLReader parser = (XMLReader)Class.forName(PARSER_NAME).newInstance();

// Set the parser's content handler

// parser.setContentHandler(dp);

// Set the parsers error handler

parser.setErrorHandler(dp);

// Parse the file named in the argument

parser.parse(args[0]);

}

catch (Exception ex)

{

System.out.println(ex.getMessage());

ex.printStackTrace();

}

}

publicvoid characters(char[] ch,int start,int length)

{

String chars ="";

for (int i = start; i < start + length; i++)

{

chars = chars + ch[i];

}

System.out.println("Recieved characters: " + chars);

}

publicvoid startDocument()

{

System.out.println("Start Document.");

}

publicvoid endDocument()

{

System.out.println("End of Document.");

}

publicvoid startElement(String namespaceURI, String localName, String qName, Attributes atts)

{

System.out.println("Start element: " + localName);

for (int i = 0; i < atts.getLength(); i++)

{

System.out.println("Attribute: " + atts.getLocalName(i));

System.out.println("Value: " + atts.getValue(i));

}

}

publicvoid endElement(String namespaceURI, String localName, String qName)

{

System.out.println("End of element: " + localName);

}

publicvoid startPrefixMapping(String prefix, String uri)

{

System.out.println("Prefix mapping: " + prefix);

System.out.println("URI: " + uri);

}

publicvoid endPrefixMapping(String prefix)

{

System.out.println("End of prefix mapping: " + prefix);

}

publicvoid ignorableWhitespace(char[] ch,int start,int length)

{

System.out.println("Recieved whitespace.");

}

publicvoid processingInstruction(String target, String data)

{

System.out.println("Recieved processing instruction:");

System.out.println("Target: " + target);

System.out.println("Data: " + data);

}

publicvoid setDocumentLocation(Locator locator)

{

// Nada

}

publicvoid error(SAXParseException exception)

{

System.out.println("Parsing error on line " + exception.getLineNumber());

}

publicvoid fatalError(SAXParseException exception)

{

System.out.println("Fatal parsing error on line " + exception.getLineNumber());

}

publicvoid warning(SAXParseException exception)

{

System.out.println("Warning on line " + exception.getLineNumber());

}

}

[7877 byte] By [Psy] at [2007-11-26 12:04:10]
# 1
What part of 'DocumentPrinter is not abstract and does not override abstract method skippedEntity(java.lang.String) in org.xml.sax.ContentHandler' don't you understand?
ejp at 2007-7-7 12:30:16 > top of Java-index,Developer Tools,Java Compiler...
# 2

Check to make sure that the arguments are consistent with your ContentHandler class. Probably the wrong type.

I think you forgot to include the skippedEntity method, it seems to be missing. Even if an implemented class has a method that you are not using, you still have to include the method in your code even if it doesn't do anything.

Message was edited by:

ChargersTule1

ChargersTule1 at 2007-7-7 12:30:16 > top of Java-index,Developer Tools,Java Compiler...