dcsimg
saxparser problem
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Manal_Habbouche
Posted On:   Saturday, November 8, 2003 01:26 AM

Hi! I am new to XML programming and I need help to find the error in my code that generate saxException: java.lang.NullPointerException at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:524) at org.apache.crimson.parser.Parser2.parse(Parser2.java:305) at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:442) at javax.xml.parsers.SAXParser.parse(SAXParser.java:345) at javax.xml.parsers.SAXParser.parse(SAXParser.java:223) Here is the code: public class XMLTVLoader extends DefaultHandler { public void setAndParseFileNames(){ String dateStr = "20031107"; String working_directory ="/home/x03/.xml/   More>>

Hi!
I am new to XML programming and I need help to find the error in my code that generate saxException:

java.lang.NullPointerException
at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:524)
at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:442)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:223)

Here is the code:

			

public class XMLTVLoader extends DefaultHandler {
public void setAndParseFileNames(){
String dateStr = "20031107";
String working_directory ="/home/x03/.xml/";
String dayFilename = working_directory + dateStr+ ".xmltv"; File dayFile = new File(dayFilename);

try {
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser saxParser = factory.newSAXParser(); saxParser.parse(dayFilename,this); }
catch (SAXException e) {
e.printStackTrace(); // here I get the error
}
}
public void startDocument() { ... } public void endDocument() { .... }
public void startElement(String namespaceURI, String sName, String name, Attributes attrs) {}
public void characters(char[] ch, int start, int length) {}
}
   <<Less
About | Sitemap | Contact