in the mainactivity
my xml file is such the below
in my logcat after running the project it shows
05-23 08:53:30.201: W/AndroidParseXMLActivity(904): Start
05-23 08:53:30.220: W/AndroidParseXMLActivity(904): Parse1
05-23 08:53:30.300: I/System.out(904): :name
05-23 08:53:30.379: W/System.err(904): java.lang.NullPointerException
05-23 08:53:30.461: W/System.err(904): at quranlast.ir.SuraHandler.endElement(SuraHandler.java:95)
it seems that it doesn't go to startElement() at all! Could anyone help me about what the problem is?
it seems that it doesn't go to startElement() at all!
"seems not to" or "does not"? Adding a log statement would prove quickly which one. That log statement should print the localName as well. And you should read up on the difference between localName and qName; that is likely the issue here.
elenora Rezaie wrote:It doesn't go to startElement() because when I run the project in logcat it doesn't show the println() messages which I wrote like the code below: and I'm sure that the problem is not related to localName or qName.
Time to check your assumptions. How do you know startElement() not be called? Is it possible startElement() is called but still not print the statements you have? What is the actual localName? What is the actual qName? Don't guess, presume, or 'know' without proof.
It doesn't go to startElement() because when I run the project in logcat it doesn't show the println() messages which I wrote like the code below
That just proves that the "if" blocks do not get executed, it doesn't prove anything about whether or not startElement itself is called.
and I'm sure that the problem is not related to localName or qName.
So you fully understand the difference between the two, and have consciously decided to use "qName" in startElement, and "localName" in endElement?
Edit: ... which is exactly what Steve just said :-)
g tsuji wrote:
Good catch! Excellent example of the value of using the @Override annotation.