hi friends... a strange problem has cropped up... I checked several websites but couldnt find anything wrong with the code... But it returns NullPointerException...
try{
SAXParserFactory f = SAXParserFactory.newInstance();
SAXParser parser = f.newSAXParser();
XMLReader reader = parser.getXMLReader();
reader.setContentHandler(handler);
System.out.println(uri_this);
reader.parse(new InputSource(url_this.openStream()));// i get nullpointerexception here
}
catch(NullPointerException e)
{
System.out.println(e);
}
In the catch statement i have caught NullPointerException and made it print the error...
The ContentHandler is fine coz i have got parsed files for small files but for larger files it seems to not work... Wat must be the problem? Or do i need some buffering for larger files?? Please friends m clueless... and have tried all possibilities except buffering... coz i don know the coding for that...
i figured out 1 thing.. The object of the inputsource is freed before the reader.parse can finish... i don understand y its happening...
The LogCat gives the following(only the erronous part)...
01-06 15:12:27.145: INFO/System.out(319): http://mywebsite.com/products_xml.php?cPath=43
01-06 15:12:31.094: DEBUG/dalvikvm(319): GC freed 4031 objects / 203424 bytes in 189ms
01-06 15:12:31.505: DEBUG/dalvikvm(100): GC freed 3326 objects / 190192 bytes in 283ms
01-06 15:12:34.274: DEBUG/dalvikvm(319): GC freed 1153 objects / 80432 bytes in 146ms
01-06 15:12:34.646: INFO/System.out(319): java.lang.NullPointerException
I'm getting the url "url_this" 4m the constructor as arguments... sorry had a typo error...