public abstract class AbstractDOMValidator 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_SCOPE
Scope attribute.
|
protected static String |
ATTR_SELECT
Select attribute.
|
protected static String |
ATTR_SUBMIT
Submmit 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 static String |
IMAGE
Image.
|
protected static String |
MAILTO
mailto.
|
protected static String |
RESET
Reset.
|
protected static String |
SUBMIT
Submit.
|
protected XPath |
xpath
XPath instance.
|
protected static String |
XPATH_CATCHALL
Catch All XPATH expression.
|
document, documentBuilder, errorHandler
Constructor and Description |
---|
AbstractDOMValidator()
Constructor.
|
AbstractDOMValidator(boolean validateXML)
Constructor.
|
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 document contains the given element.
|
Object |
evaluate(Node node,
String exprString,
QName returnType)
Evaluate a XPATH string against a node.
|
static List<String> |
getAttributeNames(Node element)
Get the names of all the attribute of an element.
|
static String |
getAttributeValue(Node element,
String attributeName)
Get the value of an element attribute.
|
static List<String> |
getAttributeValues(NodeListIterable elements,
String attributeName)
Retrieve a list of values of an attribute for a list of elements.
|
static List<String> |
getAttributeValues(NodeList nodes,
String attributeName)
Retrieve a list of values of an attribute for a list of nodes.
|
NodeListIterable |
getChildren(Node element,
String tagName)
Get children of a given type.
|
List<String> |
getChildrenTagNames(Node element)
Get the names of all the children elements of an element.
|
Node |
getElement(String tagName) |
NodeListIterable |
getElements(Collection<String> tagNames)
Get all the elements matching one of the given tags.
|
NodeListIterable |
getElements(String tagName)
Get a list of elements matching a given tag name in the document.
|
static boolean |
hasAttribute(Node element,
String attributeName)
Check if an element has the given attribute.
|
boolean |
hasChildElement(Node element,
String tagName)
Check if an element has an child element with the given tag name.
|
addError, clear, createXMLErrorHandler, getDocument, getErrorHandler, getErrors, setDocument, setValidateXML, validate, validate
protected static final String XPATH_CATCHALL
protected static final String SUBMIT
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_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 XPath xpath
public AbstractDOMValidator()
public AbstractDOMValidator(boolean validateXML)
validateXML
- indicate if the XML input should be validated.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 NodeListIterable getElements(String tagName)
tagName
- tag name to search forpublic Object evaluate(Node node, String exprString, QName returnType)
node
- node to evaluateexprString
- evaluation expressionreturnType
- type of the results to returnpublic NodeListIterable getElements(Collection<String> tagNames)
tagNames
- tag names to matchpublic boolean hasChildElement(Node element, String tagName)
element
- element to analyzetagName
- tag name to search forpublic NodeListIterable getChildren(Node element, String tagName)
element
- element to search intagName
- name of the tags to matchpublic List<String> getChildrenTagNames(Node element)
element
- parent elementpublic static boolean hasAttribute(Node element, String attributeName)
element
- element to analyzeattributeName
- name of the attribute to searchpublic static List<String> getAttributeNames(Node element)
element
- element to analyzepublic static String getAttributeValue(Node element, String attributeName)
element
- element to analyzeattributeName
- name of the attribute to searchpublic static List<String> getAttributeValues(NodeListIterable elements, String attributeName)
elements
- the list of elements to get the attribute fromattributeName
- name of the attribute to retrieve the value frompublic static List<String> getAttributeValues(NodeList nodes, String attributeName)
nodes
- the list of nodes to get the attribute fromattributeName
- name of the attribute to retrieve the value fromCopyright © 2004–2017 XWiki. All rights reserved.