java - SAX parser returns null -


i trying parse online xml document when run following code, returns null exception in get() method. tried debugging further realise inputstream maybe returning null value. know whats wrong?

public class xmlhelper extends defaulthandler{  private string url_main = "https://www.ura.gov.sg/lsmmap/xml/lsm-test.xml";  string tag = "xmlhelper"; boolean currtag = false; string currtagval = "";  private postvalue post ;  private arraylist<postvalue> postslist = new arraylist<postvalue>();   //to read xml public void get() {     try {         saxparserfactory factory = saxparserfactory.newinstance();         saxparser msaxparser = factory.newsaxparser();         xmlreader mxmlreader = msaxparser.getxmlreader();          mxmlreader.setcontenthandler(this);          inputstream minputstream = new url(url_main).openstream();         mxmlreader.parse(new inputsource(minputstream));      } catch (exception e) {         log.e(tag, "exception123: " + e.getmessage());      } } 

}


Comments

Popular posts from this blog

How to connect android app to App engine -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

php - display validation error message next to the textbox in codeigniter -