File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Html atribute grabber Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Html atribute grabber" Watch "Html atribute grabber" New topic
Author

Html atribute grabber

Daniel Prene
Ranch Hand

Joined: Jul 15, 2005
Posts: 241
Is there a way of converting a String of html into a hash/map/collection of its attributes?

Thank you in advance,
D.P.
Steve Morrow
Ranch Hand

Joined: May 22, 2003
Posts: 657

Yes. I recommend looking at a good HTML parser, such as JTidy.
Daniel Prene
Ranch Hand

Joined: Jul 15, 2005
Posts: 241
Thank you for the help
Daniel Prene
Ranch Hand

Joined: Jul 15, 2005
Posts: 241
JTidy doesn't seem to have that functionality...
Steve Morrow
Ranch Hand

Joined: May 22, 2003
Posts: 657

Have you tried parsing a DOM with it?
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
I like the Quiotix Parser because it provides a slick visitor interface which I prefer over walking the DOM. I have some description of visitor and a link to Quiotix from HERE. In short, you'd parse an HTML string and write a visitor to extract any attributes you like from all the nodes.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Html atribute grabber