Package it.unimi.dsi.parser.callback
Class LinkExtractor
java.lang.Object
it.unimi.dsi.parser.callback.DefaultCallback
it.unimi.dsi.parser.callback.LinkExtractor
- All Implemented Interfaces:
Callback
public class LinkExtractor extends DefaultCallback
-
Field Summary
-
Constructor Summary
Constructors Constructor Description LinkExtractor()
-
Method Summary
Modifier and Type Method Description String
base()
Returns the URL specified by theBASE
element.void
configure(BulletParser parser)
Configure the parser to parse elements and certain attributes.String
metaLocation()
Returns the URL specified byMETA
HTTP-EQUIV
elements of location type.String
metaRefresh()
Returns the URL specified byMETA
HTTP-EQUIV
elements of refresh type.void
startDocument()
Receive notification of the beginning of the document.boolean
startElement(Element element, Map<Attribute,MutableString> attrMap)
Receive notification of the start of an element.Methods inherited from class it.unimi.dsi.parser.callback.DefaultCallback
cdata, characters, endDocument, endElement, getInstance
-
Field Details
-
urls
The URLs resulting from the parsing process.
-
-
Constructor Details
-
LinkExtractor
public LinkExtractor()
-
-
Method Details
-
configure
Configure the parser to parse elements and certain attributes.The required attributes are
SRC
,HREF
,HTTP-EQUIV
, andCONTENT
.- Specified by:
configure
in interfaceCallback
- Overrides:
configure
in classDefaultCallback
-
startDocument
public void startDocument()Description copied from interface:Callback
Receive notification of the beginning of the document.The callback must use this method to reset its internal state so that it can be resued. It must be safe to invoke this method several times.
- Specified by:
startDocument
in interfaceCallback
- Overrides:
startDocument
in classDefaultCallback
-
startElement
Description copied from interface:Callback
Receive notification of the start of an element.For simple elements, this is the only notification that the callback will ever receive.
- Specified by:
startElement
in interfaceCallback
- Overrides:
startElement
in classDefaultCallback
- Parameters:
element
- the element whose opening tag was found.attrMap
- a map fromAttribute
s toMutableString
s.- Returns:
- true to keep the parser parsing, false to stop it.
-
metaLocation
Returns the URL specified byMETA
HTTP-EQUIV
elements of location type. More precisely, this method returns a non-null
result iff there is at least oneMETA HTTP-EQUIV
element specifying a location URL (if there is more than one, we keep the first one).- Returns:
- the first URL specified by a
META
HTTP-EQUIV
elements of location type, ornull
.
-
base
Returns the URL specified by theBASE
element. More precisely, this method returns a non-null
result iff there is at least oneBASE
element specifying a derelativisation URL (if there is more than one, we keep the first one).- Returns:
- the first URL specified by a
BASE
element, ornull
.
-
metaRefresh
Returns the URL specified byMETA
HTTP-EQUIV
elements of refresh type. More precisely, this method returns a non-null
result iff there is at least oneMETA HTTP-EQUIV
element specifying a refresh URL (if there is more than one, we keep the first one).- Returns:
- the first URL specified by a
META
HTTP-EQUIV
elements of refresh type, ornull
.
-