Package adams.data.xml
Class DOMUtils
- java.lang.Object
-
- adams.data.xml.DOMUtils
-
public class DOMUtils extends Object
Helper class for DOM operations.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
-
-
Constructor Summary
Constructors Constructor Description DOMUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static boolean
flatten(String pathSeparator, boolean addIndex, boolean storeAttributes, boolean skipRoot, String path, Node node, int index, Properties props)
Flattens the node structure.protected static boolean
hasTextContent(Node node)
Returns whether the node has any text content or just other nested nodes.static Properties
toProperties(String pathSeparator, boolean addIndex, boolean storeAttributes, boolean skipRoot, Node node)
Flattens the DOM and turns them into properties.
-
-
-
Method Detail
-
hasTextContent
protected static boolean hasTextContent(Node node)
Returns whether the node has any text content or just other nested nodes.- Parameters:
node
- the node to test- Returns:
- 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.- Parameters:
path
- the current path, null for root elementnode
- the current nodeindex
- the index of the nodeprops
- the properties to store the data in- Returns:
- 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.- Parameters:
pathSeparator
- the path separator to useaddIndex
- whether to add the indexstoreAttributes
- whether to store the attributes as wellskipRoot
- whether to skip the rootnode
- the node to process- Returns:
- the generated properties
-
-