• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

HTML.Tag.IMG

 
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...

image_src=(String)s.getAttribute(HTML.Attribute.SRC);
// END IF
}

// END WHILE
}
..etc..

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 ]
 
He puts the "turd" in "saturday". Speaking of which, have you smelled this tiny ad?
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic