title: Parsing xml: attributes.getValue() returns null?
body: <p>See this part of my xml:</p>
  
  <pre><code>&lt;blocktype&gt;
      &lt;properties name="normal_blue" type="1"/&gt;
      &lt;resources image="brick_blue"/&gt;
      &lt;properties powerup="0" shield="0" /&gt;
  &lt;/blocktype&gt;
  </code></pre>
  
  <p>I'm using this code to parse it:</p>
  
  <pre><code>@Override
  public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
  
      if (localName.equalsIgnoreCase("level")) {
          block = null;
          inLevel = true; // parsing level
          Log.d("MyContentHandler", "Parsing Level = " + Boolean.toString(inLevel));
      } if (localName.equalsIgnoreCase("blocktype")) {
          bundle = null;
          inBlockType = true; // parsing blocktype
          Log.d("MyContentHandler", "Parsing blocktype = " + Boolean.toString(inBlockType));
      };
  
      // handling level parsing
      if (inLevel) {
          int n = 0;
          if (localName.equalsIgnoreCase("properties")) {
                  int c = Integer.parseInt(attributes.getValue("columns"));
                  int r = Integer.parseInt(attributes.getValue("rows"));
                  bundle = new XmlLevelBundle(r, c);
                  bundle.name = attributes.getValue("name");
              }// bundle might be null?
              if (localName.equalsIgnoreCase("block")) {
                  bundle.types[n] = Integer.parseInt(attributes.getValue("type"));
                  n++;
              }
      }
  
      // handling BlockType parsing
      if (inBlockType) {
  
          if (localName.equalsIgnoreCase("properties")) {
              block.name = attributes.getValue("name");
              block.type = Integer.parseInt(attributes.getValue("type")); //nullpointer?
          } else if (localName.equalsIgnoreCase("resources")) {
              block.resourceName = attributes.getValue("image");
          } else if (localName.equalsIgnoreCase("properties")) {
              block.powerUp = Integer.parseInt(attributes.getValue("powerup"));
              block.shield = Integer.parseInt(attributes.getValue("shield"));
          }
      }
  }
  </code></pre>
  
  <p>Now everything seems to work when I take away the second statement. As you can see my xml actually has the <code>type</code> attribute, still it returns null, according to the following logcat:</p>
  
  <blockquote>
    <p>12-09 18:53:30.741: WARN/System.err(851):
    java.lang.NumberFormatException: unable to parse 'null' as integer
    12-09 18:53:30.769: WARN/System.err(851):     at
    java.lang.Integer.parseInt(Integer.java:406) 12-09 18:53:30.769:
    WARN/System.err(851):     at
    java.lang.Integer.parseInt(Integer.java:382) 12-09 18:53:30.779:
    WARN/System.err(851):     at
    cd.ark.utils.MyContentHandler.startElement(MyContentHandler.java:57)</p>
    
    <p>...(sorry for formatting)</p>
  </blockquote>
  
  <p>So basically it says Null is being passing into Integer.parseInt().</p>
  
  <p>So could anyone help me with this NullPointerException? 
  I've been stuck on this for a long time.
  Thanks!</p>