Solved

import org.xml.sax is deprecated

Posted on 2003-11-10
3
278 Views
Last Modified: 2008-03-06
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");
        }
}
------------------------------------
0
Comment
Question by:hbcontract
3 Comments
 
LVL 1

Accepted Solution

by:
praburamalingam earned 50 total points
ID: 10015053
Hi hbcontact,
Instead of using jClark driver, I would suggest you to go for Xerces, which is widely used in the industry.
Download the latest driver from,
http://xml.apache.org/dist/xerces-j/

You may download Xerces-J-bin.1.4.4.zip. When you unzip it, there will be a folder called Samples. There you can find many SAX java sample programs.

Hope this might help.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now