public abstract class AbstractHTMLFilter extends Object implements HTMLFilter, HTMLConstants
HTMLFilter
providing utility methods for various common w3c dom operations.ATTRIBUTE_ALIGN, ATTRIBUTE_ALT, ATTRIBUTE_CLASS, ATTRIBUTE_FONTCOLOR, ATTRIBUTE_FONTFACE, ATTRIBUTE_FONTSIZE, ATTRIBUTE_HREF, ATTRIBUTE_ID, ATTRIBUTE_NAME, ATTRIBUTE_REL, ATTRIBUTE_ROWSPAN, ATTRIBUTE_SRC, ATTRIBUTE_STYLE, ATTRIBUTE_TARGET, TAG_A, TAG_ABBR, TAG_ACRONYM, TAG_ADDRESS, TAG_B, TAG_BLOCKQUOTE, TAG_BODY, TAG_BR, TAG_CENTER, TAG_CITE, TAG_CODE, TAG_DEL, TAG_DFN, TAG_DIV, TAG_DL, TAG_EM, TAG_FIELDSET, TAG_FONT, TAG_FORM, TAG_H1, TAG_H2, TAG_H3, TAG_H4, TAG_H5, TAG_H6, TAG_HEAD, TAG_HR, TAG_HTML, TAG_I, TAG_IMG, TAG_INS, TAG_KBD, TAG_LI, TAG_NOSCRIPT, TAG_OL, TAG_P, TAG_PRE, TAG_Q, TAG_S, TAG_SAMP, TAG_SCRIPT, TAG_SPAN, TAG_STRIKE, TAG_STRONG, TAG_STYLE, TAG_TABLE, TAG_TD, TAG_TH, TAG_TR, TAG_U, TAG_UL, TAG_VAR, WHITE_SPACE_CHARS
Constructor and Description |
---|
AbstractHTMLFilter() |
Modifier and Type | Method and Description |
---|---|
protected List<Element> |
filterChildren(Element parent,
String tagName)
Utility method for filtering an element's children with a tagName.
|
protected List<Element> |
filterDescendants(Element parent,
String[] tagNames)
Utility method for filtering an element's descendants by their tag names.
|
protected List<Element> |
filterDescendants(Element parent,
String[] tagNames,
ElementSelector elementSelector)
Utility method for filtering an element's descendants by their tag names and an
ElementSelector . |
protected boolean |
hasAttribute(List<Element> elements,
String attributeName,
boolean checkValue)
Utility method for checking if a list of elements have the same attribute set.
|
protected void |
moveChildren(Element parent,
Element destination)
Moves all child elements of the parent into destination element.
|
protected void |
replaceWithChildren(Element element)
Replaces the given
Element with it's children. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
filter
protected List<Element> filterChildren(Element parent, String tagName)
parent
- the parent Element
.tagName
- expected tagName of the children elements.protected List<Element> filterDescendants(Element parent, String[] tagNames)
parent
- the parent Element
.tagNames
- an array of tagNames.protected List<Element> filterDescendants(Element parent, String[] tagNames, ElementSelector elementSelector)
ElementSelector
.parent
- the parent Element
.tagNames
- an array of tagNames.elementSelector
- an ElementSelector
that allows further filtering of elements.protected boolean hasAttribute(List<Element> elements, String attributeName, boolean checkValue)
elements
- the list of elements.attributeName
- Name of the attribute.checkValue
- flag indicating if the value of the attribute should be equal among all the elements.protected void replaceWithChildren(Element element)
Element
with it's children.element
- the Element
to be replaced.Copyright © 2004–2021 XWiki. All rights reserved.