The moose likes XML and Related Technologies and the fly likes SAX problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "SAX problem" Watch "SAX problem" New topic

SAX problem

John Coleman
Ranch Hand

Joined: Jul 24, 2001
Posts: 65
I get
at org.apache.xerces.parsers.AbstractSAXParser.parse(
at com.abnamro.wcs.orchard.gui.madj.ImportXMLFile.main(
Exception in thread "main"
from the code below. I copied the source from the JAXP example so I cannot understand why it does not work. What is missing?
Any help much appreciated. Please reply to address below.

reply to:
[ April 29, 2002: Message edited by: Jim Yingst ]

John Coleman, MSTA<br />Sun Certified Programmer for the Java� 2 Platform<br /><br />Eurobase banking solutions<br /><a href="" target="_blank" rel="nofollow"></a>
John Wetherbie

Joined: Apr 05, 2000
Posts: 1449
I'm having difficulty locating line 179 where the exception is thrown. COuld you mark it someway?
It sounds like something is not being created properly but what the reason is is hard to say.

The only reason for time is so that everything doesn't happen all at once.
- Buckaroo Banzai
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
Ugh. That was too much work just to get the code looking semi-presentable. Anyway, the exception must have been thrown by the line
as that's the only place parse() is called. But it's not really clear what the cause is.

"I'm not back." - Bill Harding, Twister
John Coleman
Ranch Hand

Joined: Jul 24, 2001
Posts: 65
You are correct that the error occurs in the .parse method, and also that there is no way of diagnosing the error.
This makes me wonder if the Sax example in JAXP works. I also wonder if anyone unserstands Sax enough to tell me what is missing? Should I contact the author?
John Coleman
Ranch Hand

Joined: Jul 24, 2001
Posts: 65
The problem is solved. Although the error message appears to point to a problem in the .parse method, in reality it is the methods that I override that cause the error. In this case a stepwise debug reveals that a string variable was not initialised before use in .startElement method.
The moral of the tale is not to let cryptic error messages put you off running a debug or looking for obvious mistakes.
thanks anyway,
I agree. Here's the link:
subject: SAX problem
jQuery in Action, 3rd edition