import org.xml.sax is deprecated
843834Nov 10 2003 — edited Nov 12 2003Hi All, Please help ... I am a beginner of using SAX with Java. I think I don't have the org.xml.sax.* classes in my java class. So, I downloaded "saxjava-1.0" from www.megginson.com (I hope I downloaded the correct one). I unzipped the file and put it in my Java folder. However, it doesn't work when I run my Java code. I think I might missed out something ... like didn't import the file to Java classes? If so, how can I do that? My java code is trying to read an XML file and print out how many books in the xml file. After compiled, it has the following message:
"package com.jclark.xml.sax does not exists"
and 2 compiler warnings:
C:\XML\BookCounter.java:12:warning:org.xml.sax.HandlerBase in org.xml.sax has been deprecated.
C:\XML\BookCounter.java:21:warning:org.xml.sax.Parser in org.xml.sax has been deprecated.
My java code as follow:
------------------------------
import org.xml.sax.*;
public class BookCounter extends HandlerBase
{
public static void main (String args[]) throws Exception
{
(new BookCounter()).countBooks();
}
public void countBooks() throws Exception
{
Parser p = new com.jclark.xml.sax.Driver();
p.setDocumentHandler(this);
p.parse("file:///C:/books.xml");
}
}
------------------------------------