public abstract class AbstractHTML5Validator extends AbstractXMLValidator
Modifier and Type | Field and Description |
---|---|
protected static String |
ATTR_ACCESSKEY
Accesskey attribute.
|
protected static String |
ATTR_ALT
Type attribute.
|
protected static String |
ATTR_BLUR
Blur attribute.
|
protected static String |
ATTR_CHANGE
Change attribute.
|
protected static String |
ATTR_CHARSET
Charset attribute.
|
protected static String |
ATTR_CLICK
Click attribute.
|
protected static String |
ATTR_CONTENT
Content attribute.
|
protected static String |
ATTR_FOCUS
Focus attribute.
|
protected static String |
ATTR_HREF
Href attribute.
|
protected static String |
ATTR_ID
ID attribute.
|
protected static String |
ATTR_LOAD
Load attribute.
|
protected static String |
ATTR_MOUSEOVER
Mouseover attribute.
|
protected static String |
ATTR_ROLE
Role attribute.
|
protected static String |
ATTR_SCOPE
Scope attribute.
|
protected static String |
ATTR_SELECT
Select attribute.
|
protected static String |
ATTR_SRC
Source attribute.
|
protected static String |
ATTR_SUBMIT
Submmit attribute.
|
protected static String |
ATTR_TITLE
Title attribute.
|
protected static String |
ATTR_TYPE
Type attribute.
|
protected static String |
ATTR_UNLOAD
Unload attribute.
|
protected static String |
BUTTON
Button.
|
protected static String |
ELEM_AREA
Area element.
|
protected static String |
ELEM_BODY
Body element.
|
protected static String |
ELEM_BOLD
Bold element.
|
protected static String |
ELEM_BR
Line break element.
|
protected static String |
ELEM_FIELDSET
Fieldset element.
|
protected static String |
ELEM_FORM
Form element.
|
protected static String |
ELEM_FRAME
Frame element.
|
protected static String |
ELEM_FRAMESET
Frameset element.
|
protected static String |
ELEM_H1
Heading 1 element.
|
protected static String |
ELEM_HTML
HTML element.
|
protected static String |
ELEM_IFRAME
Iframe element.
|
protected static String |
ELEM_IMG
Image element.
|
protected static String |
ELEM_INPUT
Input element.
|
protected static String |
ELEM_ITALIC
Italics element.
|
protected static String |
ELEM_LINK
Link element.
|
protected static String |
ELEM_META
Fieldset element.
|
protected static String |
ELEM_SUBMIT
Submit element.
|
protected static String |
ELEM_TABLE
Table element.
|
protected static String |
ELEM_TH
Table Header element.
|
protected static String |
HIDDEN
hidden.
|
protected org.jsoup.nodes.Document |
html5Document
Document parsed with JSoup.
|
protected static String |
IMAGE
Image.
|
protected static String |
MAILTO
mailto.
|
protected static String |
RESET
Reset.
|
protected static String |
STYLE
Style.
|
protected static String |
SUBMIT
Submit.
|
document, documentBuilder, errorHandler
Constructor and Description |
---|
AbstractHTML5Validator() |
Modifier and Type | Method and Description |
---|---|
protected void |
assertFalse(ValidationError.Type errorType,
String message,
boolean condition)
Asserts that a condition is false.
|
protected void |
assertTrue(ValidationError.Type errorType,
String message,
boolean condition)
Asserts that a condition is true.
|
boolean |
containsElement(String tagName)
Check if the html5Document contains the given element.
|
static List<String> |
getAttributeNames(org.jsoup.nodes.Element element)
Get the names of all the attribute of an element.
|
static String |
getAttributeValue(org.jsoup.nodes.Element element,
String attributeName)
AbstractDOMValidator Get the value of an element attribute.
|
static List<String> |
getAttributeValues(org.jsoup.select.Elements elements,
String attributeName)
Retrieve a list of values of an attribute for a list of elements.
|
org.jsoup.select.Elements |
getChildren(org.jsoup.nodes.Element element,
String tagName)
Get children of a given type.
|
List<String> |
getChildrenTagNames(org.jsoup.nodes.Element element)
Get the names of all the children elements of an element.
|
org.jsoup.nodes.Element |
getElement(String tagName) |
org.jsoup.select.Elements |
getElements(Collection<String> tagNames)
Get all the elements matching one of the given tags.
|
org.jsoup.select.Elements |
getElements(String tagName)
Get a list of elements matching a given tag name in the html5Document.
|
org.jsoup.nodes.Document |
getHTML5Document() |
static boolean |
hasAttribute(org.jsoup.nodes.Element element,
String attributeName)
Check if an element has the given attribute.
|
boolean |
hasChildElement(org.jsoup.nodes.Element element,
String tagName)
Check if an element has an child element with the given tag name.
|
void |
setDocument(InputStream document)
Set document to validate.
|
void |
setHTML5Document(InputStream document)
Set document to validate.
|
List<ValidationError> |
validate()
Run validation.
|
addError, clear, createXMLErrorHandler, getDocument, getErrorHandler, getErrors, setValidateXML, validate
protected static final String SUBMIT
protected static final String STYLE
protected static final String IMAGE
protected static final String RESET
protected static final String BUTTON
protected static final String MAILTO
protected static final String HIDDEN
protected static final String ELEM_HTML
protected static final String ELEM_BODY
protected static final String ELEM_H1
protected static final String ELEM_BR
protected static final String ELEM_BOLD
protected static final String ELEM_ITALIC
protected static final String ELEM_SUBMIT
protected static final String ELEM_FRAMESET
protected static final String ELEM_FRAME
protected static final String ELEM_IFRAME
protected static final String ELEM_LINK
protected static final String ELEM_INPUT
protected static final String ELEM_IMG
protected static final String ELEM_AREA
protected static final String ELEM_TABLE
protected static final String ELEM_TH
protected static final String ELEM_FORM
protected static final String ELEM_FIELDSET
protected static final String ELEM_META
protected static final String ATTR_TYPE
protected static final String ATTR_ALT
protected static final String ATTR_HREF
protected static final String ATTR_TITLE
protected static final String ATTR_ROLE
protected static final String ATTR_BLUR
protected static final String ATTR_CHANGE
protected static final String ATTR_CLICK
protected static final String ATTR_FOCUS
protected static final String ATTR_LOAD
protected static final String ATTR_MOUSEOVER
protected static final String ATTR_SELECT
protected static final String ATTR_SUBMIT
protected static final String ATTR_UNLOAD
protected static final String ATTR_ACCESSKEY
protected static final String ATTR_SCOPE
protected static final String ATTR_ID
protected static final String ATTR_CONTENT
protected static final String ATTR_CHARSET
protected static final String ATTR_SRC
protected org.jsoup.nodes.Document html5Document
public void setDocument(InputStream document)
Validator
setDocument
in interface Validator
setDocument
in class AbstractXMLValidator
document
- document to validatepublic void setHTML5Document(InputStream document)
document
- document to validatepublic org.jsoup.nodes.Document getHTML5Document()
public List<ValidationError> validate()
Validator
validate
in interface Validator
validate
in class AbstractXMLValidator
protected void assertFalse(ValidationError.Type errorType, String message, boolean condition)
errorType
- type of the errormessage
- the message to addcondition
- condition to be checkedprotected void assertTrue(ValidationError.Type errorType, String message, boolean condition)
errorType
- type of the errormessage
- the message to addcondition
- condition to be checkedpublic boolean containsElement(String tagName)
tagName
- element to searchpublic org.jsoup.select.Elements getElements(String tagName)
tagName
- tag name to search forpublic org.jsoup.select.Elements getElements(Collection<String> tagNames)
tagNames
- tag names to matchpublic boolean hasChildElement(org.jsoup.nodes.Element element, String tagName)
element
- element to analyzetagName
- tag name to search forpublic org.jsoup.select.Elements getChildren(org.jsoup.nodes.Element element, String tagName)
element
- element to search intagName
- name of the tags to matchpublic List<String> getChildrenTagNames(org.jsoup.nodes.Element element)
element
- parent elementpublic static boolean hasAttribute(org.jsoup.nodes.Element element, String attributeName)
element
- element to analyzeattributeName
- name of the attribute to searchpublic static List<String> getAttributeNames(org.jsoup.nodes.Element element)
element
- element to analyzepublic static String getAttributeValue(org.jsoup.nodes.Element element, String attributeName)
element
- element to analyzeattributeName
- name of the attribute to searchpublic static List<String> getAttributeValues(org.jsoup.select.Elements elements, String attributeName)
elements
- the list of elements to get the attribute fromattributeName
- name of the attribute to retrieve the value frompublic org.jsoup.nodes.Element getElement(String tagName)
tagName
- name of the tag to matchCopyright © 2004–2021 XWiki. All rights reserved.