title: R SAX Parse attribute in empty element XML
body: <p>I am new to R and I cannot find example of extracting specific attribute in an empty element, most example i found are extracting data value of a child nodes.</p>
  
  <p>In a nutshell, how to extract an attribute using xmlEventParse() for XML like this:</p>
  
  <pre><code>&lt;elements&gt;
      &lt;element attribute1="value" attribute2="value"/&gt;
      &lt;element attribute1="value" attribute2="value"/&gt;
  &lt;/elements&gt;
  </code></pre>
  
  <p>Assuming I want to get <strong>attribute1</strong> on the <strong>2nd element</strong>.</p>
  
  <p>Thanks in advance.</p>
  
  <p>Update: Found the solution. It is xmlAttrs(root[[2]])[['attribute1']]</p>