class attribute of a xml element
<p>I am making my own method which returns me NodeList containing nodes of specified class attribute value from a XML. class name is passed as a parameter to the method. The only problem is that I am not able to get the value of the class attribute from a particular element of the XML. Is there any method to get the value of the class attribute from an element. By XML I mean the XML page which comes as a HttpResponse to a HttpRequest. In short when I fire a query (eg. www.google.com) on internet the page which comes as a reply is the XML page which I am talking about.
The method is as follows:-</p>

<pre><code>public NodeList getElementsByClassName(String className, String tagName, Document document)
 {
     NodeList nl1=document.getElementsByTagName(tagName);
     NodeList nl2 = null;
     for(int i=0; i&lt;nl1.getLength(); i++)
     {
         //IN THIS LOOP I WILL CHECK WHICH ALL ELEMENTS NEED TO BE ADDED IN nl2 BASED ON VALUE OF class ATTRIBUTE OF THE "i" ELEMENT
         //HERE IS THE PROBLEM. I DON'T KNOW THE METHOD TO GET AN VALUE IF class ATTRIBUTE OF THE ELEMENT 
     }
     return nl2; //ELEMENTS WHICH WERE ADDED ABOVE IN nl2 ARE RETURNED
 }
</code></pre>
