dcsimg
Another parsing problem
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Eric_Tchepannou
Posted On:   Wednesday, April 25, 2001 03:50 AM

Hi I have modified my code, and no I musing the xerces parser I dapted an example from their site to my own program now it looks like this: class FormObjectModell extends DefaultHandler { FormobjectModell () { super (); } ... protected static class FormAllErrorHandler { ... } ... public void doParse (String xmlFile) { SAXParserFactory factory = SAXParserFactory.newInstance (); try { System.out.println ("START..."); org.apache.xerces.parsers.SAXParser parser = ne   More>>

Hi

I have modified my code, and no I musing the xerces parser

I dapted an example from their site to my own program

now it looks like this:



class FormObjectModell extends DefaultHandler

{

FormobjectModell ()

{

super ();

}

...

protected static class FormAllErrorHandler

{

...

}

...

public void doParse (String xmlFile)

{

SAXParserFactory factory = SAXParserFactory.newInstance ();

try

{

System.out.println ("START...");


org.apache.xerces.parsers.SAXParser parser = new org.apache.xerces.parsers.SAXParser ();

parser.setFeature("http://xml.org/sax/features/validation", true);

parser.setErrorHandler (new FormAllErrorHandler (System.err));

FormObjectModell handler = new FormObjectModell ();

parser.setContentHandler (handler);

FileReader fr = new FileReader (xmlFile);

parser.parse (new org.xml.sax.InputSource (fr));


System.out.println ("
OVER AN OUT!");

}

catch (Throwable t)

{

t.printStackTrace ();

}


return;

}

}



Program output:

START...

java.lang.NullPointerException

at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:965)

at com.tcheer.FormAll.xml.FormObjectModell.doParse(FormObjectModell.java:348)

at FormAllClient.main(FormAllClient.java:21)


PLEASE HELP.


Thanks.

   <<Less
About | Sitemap | Contact