aspose file tools*
The moose likes XML and Related Technologies and the fly likes sax parser program not  running Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply locked New topic
Author

sax parser program not running

sai Narayan
Greenhorn

Joined: Aug 16, 2004
Posts: 21
hi friends ,
i am new to xml.i am trying to run a sax parser program and i am getting some errors.can you please help:-

Java file:-



xml file:-


Warnings while compiling:-
C:\shanker\xmlfiles>javac -deprecation BooksLibrary.java
BooksLibrary.java:18: warning: org.xml.sax.HandlerBase in org.xml.sax has been d
eprecated
public class BooksLibrary extends HandlerBase
^
BooksLibrary.java:64: warning: org.xml.sax.AttributeList in org.xml.sax has been
deprecated
public void startElement (String name, AttributeList attrs)
^
BooksLibrary.java:64: warning: org.xml.sax.AttributeList in org.xml.sax has been
deprecated
public void startElement (String name, AttributeList attrs)
^
3 warnings

Errors while trying to run the program:-
C:\shanker\xmlfiles>java BooksLibrary
Exception in thread "main" java.lang.NoClassDefFoundError: org/xml/sax/HandlerBa
se
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:493)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:11
1)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)

Please help
thanks.



Edit Comment:
When posting code, please use the [ code ] [ / code ] tags without the
spaces. Thanks.

- m
[ November 04, 2004: Message edited by: Madhav Lakkapragada ]
gudla Dathathreya Reddy
Greenhorn

Joined: May 05, 2004
Posts: 15
hi guy,
You r using a deprecated methods of SAX API. You can compile your file as like this 'javac FileName -deprecation' , Now it will compile. Even u have to use the JDK version 1.3 and above and check whether class path is set properly .

Regards,
Dathathreya Reddy
sai Narayan
Greenhorn

Joined: Aug 16, 2004
Posts: 21
hi datatreya,
i have jsdk1.4.i tried using javac filename -deprecation but even then i am getting 3 warnings .when i try to run then i am getting an error saying NoClassDefFoundError org/sax/handlerBase not found.
can you please help.
thanks
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12835
    
    5
getting an error saying NoClassDefFoundError org/sax/handlerBase not found.

If that is really the error, you are using a bad package somewhere.
org.xml.sax.HandlerBase
is the correct full name. Even though the class is deprecated I think you should be able to get it to work.
Bill
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
Your program runs fine. There's no runtime problem with deprecated
classes/messages. To me it looks like a simple Java 101 error with the
CLASSPATH.

Since you are using JSDK 1.4, add the JAVA_HOME\lib path to your CLASSPATH
inaddition to the '.' current directory and you should be able to run the
file, thus echoing the XML file.

BTW, you might want to pay close attention to the package names/paths.
If you make typos, you wouldn't even be able to compile.
Regds.

- m
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
I am closing this thread. Continue the discussion in your other thread.


- m
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: sax parser program not running