Class SearchDOM


  • public class SearchDOM
    extends Object
    Sample utility for looking though a DOM structure
    Author:
    Fugerit
    • 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, default true 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 element
        name - the name of the tag to be looked
        Returns:
        the list of element
      • findTag

        public Element findTag​(Element node,
                               String name)
        Find next Element with a give Name in a tag
        Parameters:
        node - the Element where to search
        name - the ELement name to look for
        Returns:
        the Element if found.