File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Android and the fly likes class attribute of a xml element Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "class attribute of a xml element" Watch "class attribute of a xml element" New topic
Author

class attribute of a xml element

Osama Mohammed Shaikh
Greenhorn

Joined: Mar 08, 2012
Posts: 4
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:-


Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
How would you expect a method that retrieves an attribute to be named? Does none of the methods in the Node class suggest itself?
Osama Mohammed Shaikh
Greenhorn

Joined: Mar 08, 2012
Posts: 4
I apprehend that you have not got my point.
What exactly I am asking is that, I want a method that will retrieve the value of class attribute of a particular element (element like - div or span or p) from a XHTML page.
I searched for the method but did not get any. I hope you can help me out in this. I request you to help me as soon as possible, as my submission date of project is coming fast & because of this one method things are stagnant.
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
If you can't think of how such a method might be named, I suggest you look at the javadocs of the Node interface and go through all its methods - I am certain one of them will jump out at you.
Osama Mohammed Shaikh
Greenhorn

Joined: Mar 08, 2012
Posts: 4
Well, thanks for your kind help.
I have already created it by myself. It was a little lengthy though. But its all done.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: class attribute of a xml element
 
Similar Threads
Suppress text nodes in output when empty
How to get nested elements using DOM
xml and java
Parsing an xml file from an uri
xml parsing with dom