?
Solved

import org.xml.sax is deprecated

Posted on 2003-11-10
3
Medium Priority
?
310 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 1

Accepted Solution

by:
praburamalingam earned 200 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month10 days, 21 hours left to enroll

770 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