Package de.cuioss.test.jsf.renderer.util
Class DomUtils
- java.lang.Object
-
- de.cuioss.test.jsf.renderer.util.DomUtils
-
-
Field Summary
Fields Modifier and Type Field Description static StringROOT_TEMPLATEThe root element for creatingDocuments.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<org.jdom2.Attribute>filterForAttribute(org.jdom2.Element element, String attributeName)Extracts all attributes with the given name.static List<org.jdom2.Attribute>filterForAttributeContainingValue(org.jdom2.Element element, String attributeName, String attributeValuePart)Extracts all attributes with the given name and the attribute-value containing the given String.static org.jdom2.DocumenthtmlStringToDocument(String htmlString)Creates an instance ofDocumentfor the given htmlString.
-
-
-
Field Detail
-
ROOT_TEMPLATE
public static final String ROOT_TEMPLATE
The root element for creatingDocuments. This ensures correct structure regarding xml only having one root-element- See Also:
- Constant Field Values
-
-
Method Detail
-
htmlStringToDocument
public static org.jdom2.Document htmlStringToDocument(String htmlString)
Creates an instance ofDocumentfor the given htmlString. It always usesROOT_TEMPLATEas the root element.- Parameters:
htmlString- must not be null- Returns:
- the created
DocumentwithROOT_TEMPLATEas the root element.
-
filterForAttribute
public static List<org.jdom2.Attribute> filterForAttribute(org.jdom2.Element element, String attributeName)
Extracts all attributes with the given name. The method will recursively check all children as well.- Parameters:
element- to be checked, must not be null.attributeName- to be looked for, must not be null nor empty.- Returns:
- a
Listwith the found attributes, never null but may be empty.
-
filterForAttributeContainingValue
public static List<org.jdom2.Attribute> filterForAttributeContainingValue(org.jdom2.Element element, String attributeName, String attributeValuePart)
Extracts all attributes with the given name and the attribute-value containing the given String. The method will recursively check all children as well.- Parameters:
element- to be checked, must not be null.attributeName- to be looked for, must not be null nor empty.attributeValuePart- the string of the attribute value to be filtered for.- Returns:
- a
Listwith the found attributes, never null but may be empty.
-
-