M
Mike Mimic
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
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