private final boolean acceptsAttribute(Element element, String name, String value) { return attributeFilter.accepts(element, name, value); }
private final String convertAttributeValue(Element element, String name, String value) { return attributeValueConverter.convertAttributeValue(element, name, value); }
public static void print(Node node, int level, PrintStream out) { print(node, null, null, level, out); }
/** * @return The negation of this predicate. */ public default ElementPredicate not() { return (p, e) -> !accepts(p, e); }
/** * Removes text that can be ignored. * <p> * Uses a Depth First traversal for recursion.<br> * Removal is applied on children before parent. * * @param parent The initial node. <em>MUST NOT</em> be null. * @param evaluator The evaluator. <em>MUST NOT</em> be null. */ public static void removeIgnorableText(Parent parent, Evaluator<? super Parent> evaluator) { removeMatchingChildren(parent, Node.IS_IGNORABLE_TEXT, evaluator); }
/** * Returns a converter that first applies this converter and then {@code other}. * * @param other The other converter. * @return A converter that first applies this converter and then {@code other}. * @throws IllegalArgumentException When {@code other} is {@code null}. */ public default ElementNameConverter andThen(ElementNameConverter other) { Checks.isNotNull(other, "other"); return (Parent parent, String name) -> other.convertElementName(parent, convertElementName(parent, name)); }
/** * Returns a converter that first applies {@code other} then this converter. * * @param other The other converter. * @return A converter that first applies {@code other} then this converter. * @throws IllegalArgumentException When {@code other} is {@code null}. */ public default TextContentConverter compose(TextContentConverter other) { Checks.isNotNull(other, "other"); return (Parent parent, String content) -> convertTextContent(parent, other.convertTextContent(parent, content)); }
/** * @return The negation of this predicate. */ public default TextPredicate not() { return (p, t) -> !accepts(p, t); }
public DataStats(Node node) { count(node); }
/** * Recursively removes empty attributes. * <p> * Uses a Depth First traversal for recursion.<br> * Removal is applied on parent before its children. * * @param parent The initial node. <em>MUST NOT</em> be null. * @param evaluator The evaluator. <em>MUST NOT</em> be null. */ public static void removeEmptyAttributes(Parent parent, Evaluator<? super Parent> evaluator) { removeMatchingAttributes(parent, AttributePredicate.IS_EMPTY_ATTRIBUTE, evaluator); }
/** * Returns a converter that first applies this converter and then {@code other}. * * @param other The other converter. * @return A converter that first applies this converter and then {@code other}. * @throws IllegalArgumentException When {@code other} is {@code null}. */ public default AttributeNameConverter andThen(AttributeNameConverter other) { Checks.isNotNull(other, "other"); return (Element element, String name) -> other.convertAttributeName(element, convertAttributeName(element, name)); }
private final boolean acceptsElementPre(Parent parent, Element element) { return elementPreFilter.accepts(parent, element); }
/** * Removes pure elements (they have no children and no attributes). * <p> * Uses a Depth First traversal for recursion.<br> * Removal is applied on children before parent. * * @param parent The initial node. <em>MUST NOT</em> be null. * @param evaluator The evaluator. <em>MUST NOT</em> be null. */ public static void removePureElements(Parent parent, Evaluator<? super Parent> evaluator) { removeMatchingChildren(parent, Node.IS_PURE_ELEMENT, evaluator); }
/** * @return The negation of this predicate. */ public default AttributePredicate not() { return (e, n, v) -> !accepts(e, n, v); }
/** * Returns a converter that first applies {@code other} then this converter. * * @param other The other converter. * @return A converter that first applies {@code other} then this converter. * @throws IllegalArgumentException When {@code other} is {@code null}. */ public default ElementNameConverter compose(ElementNameConverter other) { Checks.isNotNull(other, "other"); return (Parent parent, String name) -> convertElementName(parent, other.convertElementName(parent, name)); }
/** * Returns a converter that first applies this converter and then {@code other}. * * @param other The other converter. * @return A converter that first applies this converter and then {@code other}. * @throws IllegalArgumentException When {@code other} is {@code null}. */ public default TextContentConverter andThen(TextContentConverter other) { Checks.isNotNull(other, "other"); return (Parent parent, String content) -> other.convertTextContent(parent, convertTextContent(parent, content)); }
private final boolean acceptsElementPost(Parent parent, Element element) { return elementPostFilter.accepts(parent, element); }
/** * Removes comments nodes. * <p> * Uses a Depth First traversal for recursion.<br> * Removal is applied on children before parent. * * @param parent The initial node. <em>MUST NOT</em> be null. * @param evaluator The evaluator. <em>MUST NOT</em> be null. */ public static void removeComments(Parent parent, Evaluator<? super Parent> evaluator) { removeMatchingChildren(parent, Node.IS_COMMENT, evaluator); }
/** * Returns a predicate that is the logical {@code and} combination of this one and another one. * * @param other The other predicate. * @return A predicate that is the logical {@code and} combination of this one and {@code other}. * @throws IllegalArgumentException When {@code other} is {@code null}. */ public default ElementPredicate and(ElementPredicate other) { Checks.isNotNull(other, "other"); return (p, e) -> accepts(p, e) && other.accepts(p, e); }