在android中使用dom解析器的空指针异常

时间:2013-06-04 10:46:03

标签: android xml dom

我从服务器api获取xml响应。而解析xml .im获取空指针exception.below是xml响应和code.im能够获取单个节点列表但获得异常“kd.in setHighscore ()“

// xml回复

<int xmlns="http://schemas.microsoft.com/2003/10/Serialization/">700</int>

Document doc = getDomElement(responseXML);
    NodeList nl = doc.getElementsByTagName("int");
    Log.v("node","no of nodes present"+nl.getLength());
     HighestScore kd = new  HighestScore();
      try
        {
      kd.setHighScore( ((Node) nl.item(0)).getNodeValue());  

        }
        catch(Exception e)
        {
             Log.e("MYAPP", "exception", e);
        }
      return kd;

0 个答案:

没有答案