Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

class attribute of a xml element

 
Osama Mohammed Shaikh
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 2895
46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 2895
46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, thanks for your kind help.
I have already created it by myself. It was a little lengthy though. But its all done.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic