title: DOM parser to read Xml , retrieve attribute values and storing them
body: <p>Using DOM parser, I am storing attribute values in HashMap in Java and then later retrieving it  as required. Is there any other way of doing this without using maps?</p>
  
  <p><strong>Xml</strong> example:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Main&gt;
     &lt;SubMainLevels&gt;
        &lt;SubMainLevel LineNo="1" arg2="122" RollNo="11" weight="14" folds="1" /&gt;
        &lt;SubMainLevel LineNo="2" arg2="123" RollNo="12" weight="12" folds="2" /&gt;
     &lt;/SubMainLevels&gt;
  &lt;/Main&gt;
  </code></pre>
  
  <p>What I have done:</p>
  
  <pre><code>   Map&lt;String, String&gt; x = new HashMap&lt;String, String&gt;(); 
     getXmlAttr(){
      Traverse till Main\SubMainLevels\SubMainLevel       
  
       for each SubMainLevel {    
        getAttribute() for all attributes  LineNo,arg2,RollNo,weight,folds 
        concatenate strConcat = arg2+":"+RollNo+":"+weight+":"+folds
        x.put(LineNo,strConcat);
       }
      }
  
  
  
  
   retrieveAttrMap(HashMap x){
      for each HashMap key{
        strVal =x.get(key)
        split strVal at ":"
        //do stuff
      }  
   }
  </code></pre>