hi,
while going thru IBM SAX tutorial, i ran into a problem. i have the following class:
import org.xml.sax.helpers.DefaultHandler;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.XMLReader;
public class SurveyReader extends DefaultHandler{
public SurveyReader(){
System.out.println("Object Created.");
}
public void showEvent(String name){
System.out.println("Hello ," + name + "!");
}
public static void main(String[] args){
XMLReader xmlReader = null;
try{
SAXParserFactory spfactory = new SAXParserFactory.newInstance();
SAXParser saxParser = spfactory.newSAXParser();
xmlReader = saxParser.getXMLReader();
}catch(Exception e){
System.err.println(e);
System.exit(1);
}
}
}
i have dowloaded JAXP from Sun site and put it into path too. when i compile this class, the follwing is reported:
SurveyReader.java:19: cannot resolve symbol
sysmbol : class newInstance
location: class javax.xml.parsers.SAXParserFactory
SAXParserFactory spfactory = new SAXParserFactory.newInstance();
could anyone point out what wrong with it? appreciate your help. thanks.
himal
while going thru IBM SAX tutorial, i ran into a problem. i have the following class:
import org.xml.sax.helpers.DefaultHandler;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.XMLReader;
public class SurveyReader extends DefaultHandler{
public SurveyReader(){
System.out.println("Object Created.");
}
public void showEvent(String name){
System.out.println("Hello ," + name + "!");
}
public static void main(String[] args){
XMLReader xmlReader = null;
try{
SAXParserFactory spfactory = new SAXParserFactory.newInstance();
SAXParser saxParser = spfactory.newSAXParser();
xmlReader = saxParser.getXMLReader();
}catch(Exception e){
System.err.println(e);
System.exit(1);
}
}
}
i have dowloaded JAXP from Sun site and put it into path too. when i compile this class, the follwing is reported:
SurveyReader.java:19: cannot resolve symbol
sysmbol : class newInstance
location: class javax.xml.parsers.SAXParserFactory
SAXParserFactory spfactory = new SAXParserFactory.newInstance();
could anyone point out what wrong with it? appreciate your help. thanks.
himal