Get the name of all attributes in a XML-File
<p>Hey  I have an XML file and I would like to navigate to a given node and grab the name of all Attributes to that node.  </p>

<p>For example:   (XML File)</p>

<pre><code>&lt;RootName&gt;
    &lt;SubNode&gt;
    &lt;Attribute1&gt;Value 1&lt;/Attribute1&gt;
    &lt;Attribute2&gt;Value 2&lt;/Attribute2&gt;  
&lt;/SubNode&gt; 
&lt;/RootName&gt;
</code></pre>

<p>Here is my code so far: (Java Code)</p>

<pre><code>File file = new File("data.xml");
try
    {    
        /* Parse File */
        DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
        Document doc = builder.parse(file);

        /* Find Starting Tag */
        NodeList nodes = doc.getElementsByTagName(StartTag);
        for (int i = 0; i &lt; nodes.getLength(); i++)
        {
            Element element = (Element) nodes.item(i);
            System.out.println(element);

        }
</code></pre>

<p>Now I know you can find a specific attribute given the name</p>

<pre><code>String name = element.getAttribute("Attribute1");    
</code></pre>

<p>But I would like to find all these names dynamically.</p>

<p>Thanks in advance</p>

<p>-Scott</p>
