fr.paris.lutece.plugins.newsletter.util
Class HtmlDomDocNewsletter

java.lang.Object
  extended by fr.paris.lutece.plugins.newsletter.util.HtmlDomDocNewsletter

public class HtmlDomDocNewsletter
extends Object

This classes provides implementation to retrieve urls from specified tags on an HTML page.


Nested Class Summary
protected static class HtmlDomDocNewsletter.ElementUrl
          provide a description for the HTML elements to be parsed
 
Field Summary
static String CONSTANT_PROTOCOL_DELIMITER
           
static String CONSTANT_STATIC_URL
           
static HtmlDomDocNewsletter.ElementUrl ELEMENT_A
          To define a anchor, a element must have: "a" tag name The url is contained in the attributed named "href"
static HtmlDomDocNewsletter.ElementUrl ELEMENT_CSS
          To 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 HtmlDomDocNewsletter.ElementUrl ELEMENT_FORM
          To define a form, form element must have: "form" tag name The url is contained in the attributed named "action"
static HtmlDomDocNewsletter.ElementUrl ELEMENT_IMG
          To define an image, html element must have: "img" tag name The url is contained in the attributed named "src"
static HtmlDomDocNewsletter.ElementUrl ELEMENT_JAVASCRIPT
          To 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
HtmlDomDocNewsletter(String strHtml, String strBaseUrl)
          Instantiates an HtmlDocument after having built the DOM tree.
 
Method Summary
 void convertAllRelativesUrls(HtmlDomDocNewsletter.ElementUrl elementType)
          Get the relatives urls of all html elements specified by elementType and convert its to absolutes urls
protected  String getBaseUrl()
          Get the base url
 String getContent()
          Get the document content
protected  Document getDomDocument()
          Get the document used by this instance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONSTANT_STATIC_URL

public static final String CONSTANT_STATIC_URL
See Also:
Constant Field Values

CONSTANT_PROTOCOL_DELIMITER

public static final String CONSTANT_PROTOCOL_DELIMITER
See Also:
Constant Field Values

ELEMENT_CSS

public static final HtmlDomDocNewsletter.ElementUrl ELEMENT_CSS
To define a CSS, html element must have: The url is contained in the attributed named "href"


ELEMENT_JAVASCRIPT

public static final HtmlDomDocNewsletter.ElementUrl ELEMENT_JAVASCRIPT
To define a javascript, html element must have: The url is contained in the attributed named "src"


ELEMENT_IMG

public static final HtmlDomDocNewsletter.ElementUrl ELEMENT_IMG
To define an image, html element must have: The url is contained in the attributed named "src"


ELEMENT_A

public static final HtmlDomDocNewsletter.ElementUrl ELEMENT_A
To define a anchor, a element must have: The url is contained in the attributed named "href"


ELEMENT_FORM

public static final HtmlDomDocNewsletter.ElementUrl ELEMENT_FORM
To define a form, form element must have: The url is contained in the attributed named "action"

Constructor Detail

HtmlDomDocNewsletter

public HtmlDomDocNewsletter(String strHtml,
                            String strBaseUrl)
Instantiates an HtmlDocument after having built the DOM tree.

Parameters:
strHtml - The Html code to be parsed.
strBaseUrl - The Base url used to retrieve urls.
Method Detail

convertAllRelativesUrls

public void convertAllRelativesUrls(HtmlDomDocNewsletter.ElementUrl elementType)
Get the relatives urls of all html elements specified by elementType and convert its to absolutes urls

Parameters:
elementType - the type of element to get

getContent

public String getContent()
Get the document content

Returns:
The String content

getDomDocument

protected Document getDomDocument()
Get the document used by this instance

Returns:
The document used by this instance

getBaseUrl

protected String getBaseUrl()
Get the base url

Returns:
The base url


Copyright © 2013 Mairie de Paris. All Rights Reserved.