xml
Class HtmlReferences.HrefCallback

java.lang.Object
  extended by javax.swing.text.html.HTMLEditorKit.ParserCallback
      extended by xml.HtmlReferences.HrefCallback
Enclosing class:
HtmlReferences

private static final class HtmlReferences.HrefCallback
extends HTMLEditorKit.ParserCallback

A helper callback class that scans for href attributes in anchors.


Field Summary
private  URL base
          The base of the URL document.
private  List<URL> ref
          All references found, resolved against the base URL.
 
Fields inherited from class javax.swing.text.html.HTMLEditorKit.ParserCallback
IMPLIED
 
Constructor Summary
private HtmlReferences.HrefCallback(URL from)
          Constructs a new callback that only listens to 'a' tags.
 
Method Summary
 List<URL> getAllReferences()
          Returns all references found.
 void handleStartTag(HTML.Tag tag, MutableAttributeSet mas, int p)
          If the tag encountered is a HTML.Tag.A tag and has an attribute named 'href' attached to it, we construct a new url from it and store it in our list.
 
Methods inherited from class javax.swing.text.html.HTMLEditorKit.ParserCallback
flush, handleComment, handleEndOfLineString, handleEndTag, handleError, handleSimpleTag, handleText
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

base

private URL base
The base of the URL document.


ref

private List<URL> ref
All references found, resolved against the base URL.

Constructor Detail

HtmlReferences.HrefCallback

private HtmlReferences.HrefCallback(URL from)
Constructs a new callback that only listens to 'a' tags.

Method Detail

handleStartTag

public void handleStartTag(HTML.Tag tag,
                           MutableAttributeSet mas,
                           int p)
If the tag encountered is a HTML.Tag.A tag and has an attribute named 'href' attached to it, we construct a new url from it and store it in our list.

Overrides:
handleStartTag in class HTMLEditorKit.ParserCallback

getAllReferences

public List<URL> getAllReferences()
Returns all references found.