title: get xml all attributes using jquery
body: <p>I want to get attribute value from a xml file, I am using following code to get attribute value:</p>
  
  <pre><code>var result=$(xml).find("segment[id=1]").attr("name");
  </code></pre>
  
  <p>But as it's definition of attr, it is returning only first value. I need all attrib values, I have studied about .each() function in xml parsing. But I failed to get all attributes.
  xml is following :-</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
      &lt;code_gen&gt;
       &lt;segment id="1" name="POS"&gt;POS.txt&lt;/segment&gt;
       &lt;segment id="1" name="On_Off"&gt;on_off.txt&lt;/segment&gt;
       &lt;segment id="1" name="Sellert"&gt;seller.txt&lt;/segment&gt;
       &lt;segment id="1" name="Cross_Border"&gt;cross.txt&lt;/segment&gt;
       &lt;segment id="1" name="NA"&gt;NA.txt&lt;/segment&gt;
      &lt;/code_gen&gt;
  </code></pre>