Package org.fugerit.java.core.xml.dom
Class SearchDOM
- java.lang.Object
-
- org.fugerit.java.core.xml.dom.SearchDOM
-
public class SearchDOM extends Object
Sample utility for looking though a DOM structure- Author:
- Fugerit
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Element>
findAllTags(Element node, String name)
Finds all Element child to a given element with a given tag name.List<String>
findAllText(Element node)
Finds all the texts contained in a ElementElement
findTag(Element node, String name)
Find next Element with a give Name in a tagString
findText(Element node)
Finds the text contained in an Elementstatic SearchDOM
newInstance()
Return a new SearchDOM object, defaulttrue
to both trimText and ignoreBlankstatic SearchDOM
newInstance(boolean trimText, boolean ignoreBlank)
Creates a new SearchDOM instance
-
-
-
Method Detail
-
newInstance
public static SearchDOM newInstance(boolean trimText, boolean ignoreBlank)
Creates a new SearchDOM instance- Parameters:
trimText
- should test be trimmed?ignoreBlank
- should blank spaces be ignored?- Returns:
- the SearchDOM object
-
newInstance
public static SearchDOM newInstance()
Return a new SearchDOM object, defaulttrue
to both trimText and ignoreBlank- Returns:
- the SearchDOM object
-
findText
public String findText(Element node)
Finds the text contained in an Element- Parameters:
node
- the element- Returns:
- the text
-
findAllText
public List<String> findAllText(Element node)
Finds all the texts contained in a Element- Parameters:
node
- the element- Returns:
- list of text
-
findAllTags
public List<Element> findAllTags(Element node, String name)
Finds all Element child to a given element with a given tag name.- Parameters:
node
- the elementname
- the name of the tag to be looked- Returns:
- the list of element
-
-