title: reading XML response in android
body: <p>I'm trying to read and the XML response from the following url
      <a href="http://sagt.vizushop.com/DefaultSimple.aspx?command=default" rel="nofollow">http://sagt.vizushop.com/DefaultSimple.aspx?command=default</a>     </p>
  
  <p>I use the following code in my android project to get the first item and then its 2nd node's value.</p>
  
  <pre><code>String uri="http://sagt.vizushop.com/DefaultSimple.aspx?command=default";
  String [] data=new String [9];
  try{
      URL url = new URL(uri);
      HttpURLConnection con = (HttpURLConnection) url.openConnection();
      con.setRequestMethod("GET");
      con.setDoOutput(true);
  
      con.connect();
      data = new String[9];
      if (con.getResponseCode() == HttpURLConnection.HTTP_OK) {                        
          DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
          DocumentBuilder db = dbf.newDocumentBuilder();
          Document doc = db.parse(con.getInputStream());
          NodeList itemnodes=doc.getElementsByTagName("item");
          Node firstitemnode=itemnodes.item(0);
          NodeList childnodesoffirstitemnode=firstitemnode.getChildNodes();
          Node firstnodeOffirstitem=childnodesoffirstitemnode.item(1);
          String contenturl=firstnodeOffirstitem.getNodeValue().toString();
          data[0] = contenturl;
      }
  </code></pre>
  
  <p>But it gives a java.lang.NullPointerException.</p>
  
  <p>Please help on this</p>
  
  <p>Thank in advance</p>