Package fr.paris.lutece.util.mail
Class HtmlDocument
java.lang.Object
fr.paris.lutece.util.mail.HtmlDocument
This classes provides implementation to retrieve urls from specified tags on an HTML page.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final fr.paris.lutece.util.mail.HtmlDocument.ElementUrlTo define a CSS, html element must have: "link" tag name "rel" attribute equal to "stylesheet" The url is contained in the attributed named "href"static final fr.paris.lutece.util.mail.HtmlDocument.ElementUrlTo define an image, html element must have: "img" tag name The url is contained in the attributed named "src"static final fr.paris.lutece.util.mail.HtmlDocument.ElementUrlTo define a javascript, html element must have: "script" tag name "type" attribute equal to "text/javascript" The url is contained in the attributed named "src" -
Constructor Summary
ConstructorsConstructorDescriptionHtmlDocument(String strHtml, String strBaseUrl, boolean useAbsoluteUrl) Instanciates an HtmlDocument after having built the DOM tree. -
Method Summary
Modifier and TypeMethodDescriptiongetAllUrls(fr.paris.lutece.util.mail.HtmlDocument.ElementUrl elementType) Get the urls of all html elements specified by elementTypegetAllUrlsAttachement(fr.paris.lutece.util.mail.HtmlDocument.ElementUrl elementType) Get the urls of all html elements specified by elementType
-
Field Details
-
ELEMENT_CSS
public static final fr.paris.lutece.util.mail.HtmlDocument.ElementUrl ELEMENT_CSSTo define a CSS, html element must have:- "link" tag name
- "rel" attribute equal to "stylesheet"
-
ELEMENT_JAVASCRIPT
public static final fr.paris.lutece.util.mail.HtmlDocument.ElementUrl ELEMENT_JAVASCRIPTTo define a javascript, html element must have:- "script" tag name
- "type" attribute equal to "text/javascript"
-
ELEMENT_IMG
public static final fr.paris.lutece.util.mail.HtmlDocument.ElementUrl ELEMENT_IMGTo define an image, html element must have:- "img" tag name
-
-
Constructor Details
-
HtmlDocument
Instanciates an HtmlDocument after having built the DOM tree.- Parameters:
strHtml- The Html code to be parsed.strBaseUrl- The Base url used to retrieve urls.useAbsoluteUrl- Determine if we use absolute or relative url for HTML element's names
-
-
Method Details
-
getAllUrls
Get the urls of all html elements specified by elementType- Parameters:
elementType- the type of element to get- Returns:
- a Collection containing the urls. Those urls are Objects, as defined by getUrl().
-
getAllUrlsAttachement
public List<UrlAttachment> getAllUrlsAttachement(fr.paris.lutece.util.mail.HtmlDocument.ElementUrl elementType) Get the urls of all html elements specified by elementType- Parameters:
elementType- the type of element to get- Returns:
- a Collection containing the urls. Those urls are Objects, as defined by getUrl().
-