Class DOMUtils

  • public class DOMUtils
    extends Object
    Helper class for DOM operations.
    FracPete (fracpete at waikato dot ac dot nz)
    • Constructor Detail

      • DOMUtils

        public DOMUtils()
    • Method Detail

      • hasTextContent

        protected static boolean hasTextContent​(Node node)
        Returns whether the node has any text content or just other nested nodes.
        node - the node to test
        true if actual textual content available
      • flatten

        protected static boolean flatten​(String pathSeparator,
                                         boolean addIndex,
                                         boolean storeAttributes,
                                         boolean skipRoot,
                                         String path,
                                         Node node,
                                         int index,
                                         Properties props)
        Flattens the node structure.
        path - the current path, null for root element
        node - the current node
        index - the index of the node
        props - the properties to store the data in
        true if node was added
      • toProperties

        public static Properties toProperties​(String pathSeparator,
                                              boolean addIndex,
                                              boolean storeAttributes,
                                              boolean skipRoot,
                                              Node node)
        Flattens the DOM and turns them into properties.
        pathSeparator - the path separator to use
        addIndex - whether to add the index
        storeAttributes - whether to store the attributes as well
        skipRoot - whether to skip the root
        node - the node to process
        the generated properties