Even though you have validating set to false, check your XML document that you 
are parsing for well-formness (XMLSpy works for me). I have seen this error 
before usually when  validating vs. the schema.

Sal
> 
> From: "Raymond Hooker \(rhooker\)" <[EMAIL PROTECTED]>
> Date: 2005/04/06 Wed PM 06:58:29 EDT
> To: "Research Triangle Java User's Group mailing list." <[email protected]>
> Subject: [Juglist] SAX Parse Exception
> 
> Pardon the basic question but I cannot see what the problem is.  I was
> going through the SAX tutorials using Eclipse 3.0.2 and Java SDK
> 1.4.2_07.  Anyhow the following code gets throws
> java.lang.NullPointerException:
> 
> 
>               String rulesFile =
> fileDialog.getDirectory()+fileDialog.getFile();
>         // Use an instance of ourselves as the SAX event handler
>                 DefaultHandler handler = new Echo();
>                
>                       // Use the default (non-validating) parser
>                 SAXParserFactory factory =
> SAXParserFactory.newInstance();
>                 try {
>                   // Set up output stream
>                   out = new OutputStreamWriter(System.out, "UTF8");
>                
>                    // Parse the input 
>                   File Filerules = new File(rulesFile);
>                   SAXParser saxParser = factory.newSAXParser();
>                   saxParser.parse( Filerules, handler );
> <----Exception occurs here
>                
>                       } catch (Throwable t) {
>                   t.printStackTrace();
>                 }
> 
> I verified that by a breakpoint that the time of exception Filerules was
> File object that is not null, and handler is a Echo instance.  Echo is
> class that extends DefaultHandler.  Echo has a number of methods to
> handle events like startDocument and startElement.  According to the
> JavaDoc, I don't believe that the parse method is supposed to throw a
> nullPointerException.  BTW the actual stack trace is:
> 
> java.lang.NullPointerException
>       at
> org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:691)
>       at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
>       at
> org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
>       at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
>       at javax.xml.parsers.SAXParser.parse(SAXParser.java:281)
>       at Tree.rulesTree.main(rulesTree.java:103)
> 
> I have tried various file contents.
> 
> Ray
> 
> _______________________________________________
> Juglist mailing list
> [email protected]
> http://trijug.org/mailman/listinfo/juglist_trijug.org
> 


_______________________________________________
Juglist mailing list
[email protected]
http://trijug.org/mailman/listinfo/juglist_trijug.org

Reply via email to