Solved

import org.xml.sax is deprecated

Posted on 2003-11-10
3
295 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 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying 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

Suggested Solutions

Title # Comments Views Activity
Mongodb hierarchy 2 63
parse convert xml feed to text (python) 2 102
Online tools to transform xml to excel using xsl 1 52
PowerShell script to remove string in xml file 8 47
The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

749 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