Compile problem using SAX Parser and ant tool

M

Mladen Adamovic

I made some SAX classes for parsing in Eclipse and there is everything OK.

I saved its source into /my_project/src where is my project which
use ant.
Build.xml should put it into appropriate Tomcat webapps.

But when I compile it (ant all) I have compile errors.
It seemed to me that I have classpath error.
But SAXParser class is in rt.jar as for example StringBuffer, and ant
don't make problems with StringBuffer.

I see in the documentation :
The system property that controls which Factory implementation to create
is named "javax.xml.parsers.SAXParserFactory". This property names a
class that is a concrete subclass of this abstract class. If no property
is defined, a platform default will be used.

But what to do?

Above are compile errors which don't appear in Eclise :

Buildfile: build.xml
<snip>

compile:
[javac] Compiling 12 source files to /jakarta-tomcat-5.5.4/webapps/searchwrap/WEB-INF/classes
[javac] /searchwrap/src/common/GeekXMLHandler.java:9: error: Class or interface `javax.xml.parsers.SAXParser' not found in import.
[javac] import javax.xml.parsers.SAXParser;
[javac] ^
[javac] /searchwrap/src/common/GeekXMLHandler.java:24: error: Type `SAXParserFactory' not found in the declaration of the local variable `factory'.
[javac] SAXParserFactory factory = SAXParserFactory.newInstance();
[javac] ^
[javac] /searchwrap/src/common/GeekXMLHandler.java:27: error: Type `SAXParser' not found in the declaration of the local variable `saxParser'.
[javac] SAXParser saxParser = factory.newSAXParser();
[javac] ^
[javac] 3 errors


Thanks for help in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,189
Members
46,736
Latest member
zacharyharris

Latest Threads

Top