title: XML string to JSON javascript
body: <p>I have a xml string which i want to convert in JSON string</p>
  
  <pre><code>var txt = "&lt;?xml version='1.0' encoding='UTF-8' ?&gt;
                   &lt;result&gt;
                     &lt;info&gt;
                        &lt;id&gt;1&lt;/id&gt;
                        &lt;type&gt;HL&lt;/type&gt;
                        &lt;ven&gt;DEMOMA&lt;/ven&gt;
                     &lt;/info&gt;
                     &lt;info&gt;
                        &lt;id&gt;2&lt;/id&gt;
                        &lt;type&gt;HL&lt;/type&gt;
                        &lt;ven&gt;DEMOMB&lt;/ven&gt;
                     &lt;/info&gt;
                 &lt;result&gt;";
  </code></pre>
  
  <p>i tried to initially convert it in DOM object using parser but it throws parsing error.</p>
  
  <pre><code>parser = new DOMParser();
  xmlDoc = parser.parseFromString(txt,"text/xml");
  </code></pre>
  
  <p>i want my output json string like only by using Javascript</p>
  
  <pre><code>{"result":[{"id":"1","type":"HL","ven":"DEMOMA"},{"id":"2","type":"HL","ven":"DEMOMB"}]}
  </code></pre>