title: How to parse tags in java
body: <p>Response from server is like this:</p>
  
  <pre><code>&lt;oob&gt;
     &lt;type&gt;screen&lt;/type&gt;
     &lt;value&gt;idle&lt;/value&gt;
     &lt;action&gt;show&lt;/action&gt;
  &lt;/oob&gt;
  &lt;oob&gt;
     &lt;type&gt;schedule&lt;/type&gt;
     &lt;action&gt;show&lt;/action&gt;
  &lt;/oob&gt;
  </code></pre>
  
  <p>I want to put all the tags as key and value inside tag as value. Numbers of tags and tag types are not known. I want something like this:</p>
  
  <pre><code>//for first string from server
  
  public HashMap&lt;String, String&gt; response = new HashMap&lt;String, String&gt;();
  response.put("type","screen");
  response.put("value","idle");
  response.put("action","show");
  
  //for second string
  
  response.put("type","schedule");
  response.put("action","show");
  </code></pre>
  
  <p>There should be the logic to parse the string:</p>
  
  <pre><code>if(server_response.contains("&lt;oob&gt;")){
      while(!endof server_response)
      response.put("?","?");
  }
  </code></pre>
  
  <p>How to parse server response in that format?</p>