Iterating over IMG in HTML file
From: Mike Mimic (ppagee_at_yahoo.com)
Date: 04/29/04
- Next message: Michael Rauscher: "Re: PropertyChangeListener not recognizing changes to a putClientProperty"
- Previous message: Ralph Aichinger: "Re: Font Conversion Help : BDF --> TTF"
- Next in thread: Mike Mimic: "Re: Iterating over IMG in HTML file"
- Reply: Mike Mimic: "Re: Iterating over IMG in HTML file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 29 Apr 2004 19:26:18 +0200
Hi!
I would like that my program prints path of every image in a
HTML file (that is SRC attribute of IMG tag).
I have made this (code that prints names of all atributes in
all IMG tags):
HTMLEditorKit kit = new HTMLEditorKit();
kit.read(new BufferedReader(new FileReader(file)), html, 0);
HTMLDocument.Iterator it = html.getIterator(HTML.Tag.IMG);
while (it.isValid()) {
SimpleAttributeSet attrs =
(SimpleAttributeSet)it.getAttributes();
if (attrs != null) {
for (Enumeration e = attrs.getAttributeNames();
e.hasMoreElements();) {
System.out.println(e.nextElement());
}
}
}
and it does not work. But if I change HTML.Tag.IMG to HTML.Tag.A
it works as it should (for links).
HTML file has IMG tags (as well as A tags).
Mike
- Next message: Michael Rauscher: "Re: PropertyChangeListener not recognizing changes to a putClientProperty"
- Previous message: Ralph Aichinger: "Re: Font Conversion Help : BDF --> TTF"
- Next in thread: Mike Mimic: "Re: Iterating over IMG in HTML file"
- Reply: Mike Mimic: "Re: Iterating over IMG in HTML file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|