• Post Reply Bookmark Topic Watch Topic
  • New Topic

HTML.Tag.IMG  RSS feed

Tom Griffith
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello. If anyone has a minute, I am parsing the elements of an html page and am looking to suck out attributes for every image that the iterator encounters...sorta like this...

ElementIterator it = new ElementIterator(doc);
javax.swing.text.Element elem;

ArrayList file_name_array=new ArrayList();

while ((elem = it.next()) != null) {

SimpleAttributeSet s = (SimpleAttributeSet)elem.getAttributes().getAttribute(HTML.Tag.IMG);

if (s!=null) {
// grab the attributes, notably the src...



but all i get are nulls...the iterator doesn't seem to see the IMG tag..despite the 'IMG' paramter being documented in the HTML.Tag class. If I modify this to set up an attribute set for doc links, creating an attribute set based on HTML.Tag.A, i can get a handle on each link. I've been wrestling with this for a while. Does anybdoy have an idea why this happens? Thank you very much for your time and reading this.
[ March 20, 2007: Message edited by: Tom Griffith ]
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!