title: Xpath - How to get all the attribute names and values of an element
body: <p>I am using xpath in java. I want to get all the attributes (name &amp; Value) of an element. I found the query to get the attribute values of an element, now I want to get attribute names alone or names and values in single query.</p>
  
  <pre><code>&lt;Element1 ID="a123" attr1="value1" attr2="value2" attr3="value3" attr4="value4" attr5="value5" /&gt;
  </code></pre>
  
  <p>Here using the following query to get all the attribute values of <code>Element1</code>
  <code>XmlUtils.getAttributes(Path, String.format("//*/@*"));</code>
  Using this format <code>//*/@*</code> I can get the values. result would be <code>value1 value2 value3 value4 value5 a123</code></p>
  
  <p>Now I want to know the query to get all the attribute names, or query to get all the attributes name and value.</p>