I have used HTMLEditorKit.facebook source page have 39 <a> tags, but its printing only 8 tags href value.give me some solution for this
for (HTMLDocument.Iterator iterator =
((HTMLDocument) doc).getIterator(HTML.getTag(tag));
开发者_如何学JAVA iterator.isValid();
iterator.next()) {
count++;
AttributeSet attributes = iterator.getAttributes();
String src = (String)attributes.getAttribute(HTML.getAttributeKey(attribute));
if (src != null) {
System.out.print(attribute + ":" + src);
System.out.print("\n");
}
}
I think source page have more than one tags.HTMLDocument will read from where they opened the HTML tag to where they closed the HTML tag.
精彩评论