0

Hi,
I'm trying to develop a linkchecker, the HTML text I'm using it on though has a few lines such as this:

<li><a href="PhD/refs.html"> <b> References </b> </a> section of  PhD 
<li><a href="WWM/refs.html"> <b> References </b> </a> section of  WWM proposal

which aren't being picked up by my linkchecker. The handleText part of my link checker looks like this:

public void handleText(final char[] data, final int pos) { }
		
public void handleStartTag(Tag tag, MutableAttributeSet attribute, int pos) 
{
	if (tag == Tag.A) 
	{
	String address = (String) attribute.getAttribute("href");	list.add(address);
	System.out.println(address); 
	}
}

but it's not picking up the attributes labelled by "href". Can any-one tell me why? Please let me know if I have to add the rest of my code?

Any help much appreciated!

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by moutanna
0

Try this:

String address = (String) attribute.getAttribute(Attribute.HREF);

instead of:

String address = (String) attribute.getAttribute("href");

Hope it helps.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.