Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

import org.xml.sax is deprecated

843834Nov 10 2003 — edited Nov 12 2003
Hi 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");
}
}
------------------------------------

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 10 2003
Added on Nov 10 2003
1 comment
187 views