Class NodeMap


  • public class NodeMap
    extends java.lang.Object
    The NodeMap contains a Map representation of DOM object It can be constructed either from the children of a single Node or a NodeList.
    • Constructor Summary

      Constructors 
      Constructor Description
      NodeMap​(org.w3c.dom.Node node)
      Create a new NodeMap The Node that is passed to the constructor must not be null.
      NodeMap​(org.w3c.dom.NodeList nodeList)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.stream.Stream<org.w3c.dom.Node> getAllNodes​(java.lang.String... localNames)
      Get all matching nodes
      java.util.Optional<java.math.BigDecimal> getAsBigDecimal​(java.lang.String... localNames)
      Get the text content of a matching node In case more than one node matches, it is not guaranteed that the first match is selected
      java.util.Optional<NodeMap> getAsNodeMap​(java.lang.String... localNames)
      Get a NodeMap of the child of a matching node by LocalName In case more than one node matches, it is not guaranteed that the first match is selected
      java.util.Optional<java.lang.String> getAsString​(java.lang.String... localNames)
      Get the text content of a matching node In case more than one node matches, it is not guaranteed that the first match is selected
      java.lang.String getAsStringOrNull​(java.lang.String... localNames)
      Get the text content of a matching node In case more than one node matches, it is not guaranteed that the first match is selected
      java.util.Optional<org.w3c.dom.Node> getNode​(java.lang.String... localNames)
      Get matching node by LocalName In case more than one node matches, it is not guaranteed that the first match is selected
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • NodeMap

        public NodeMap​(org.w3c.dom.Node node)
        Create a new NodeMap The Node that is passed to the constructor must not be null. The NodeMap will be empty when no child nodes are present.
        Parameters:
        node - the node that shall be represented by this NodeMap
        Throws:
        java.lang.IllegalArgumentException - when argument is null
      • NodeMap

        public NodeMap​(org.w3c.dom.NodeList nodeList)
    • Method Detail

      • getNode

        public java.util.Optional<org.w3c.dom.Node> getNode​(java.lang.String... localNames)
        Get matching node by LocalName In case more than one node matches, it is not guaranteed that the first match is selected
        Parameters:
        localNames - one or more LocalNames
        Returns:
        the matching node
      • getAsNodeMap

        public java.util.Optional<NodeMap> getAsNodeMap​(java.lang.String... localNames)
        Get a NodeMap of the child of a matching node by LocalName In case more than one node matches, it is not guaranteed that the first match is selected
        Parameters:
        localNames - one or more LocalNames
        Returns:
        the NodeMap representation of the matching node
      • getAsString

        public java.util.Optional<java.lang.String> getAsString​(java.lang.String... localNames)
        Get the text content of a matching node In case more than one node matches, it is not guaranteed that the first match is selected
        Parameters:
        localNames - one or more LocalNames
        Returns:
        the text content of the matching node
      • getAsBigDecimal

        public java.util.Optional<java.math.BigDecimal> getAsBigDecimal​(java.lang.String... localNames)
        Get the text content of a matching node In case more than one node matches, it is not guaranteed that the first match is selected
        Parameters:
        localNames - one or more LocalNames
        Returns:
        the text content of the matching node, converted to BigDecimal
      • getAsStringOrNull

        public java.lang.String getAsStringOrNull​(java.lang.String... localNames)
        Get the text content of a matching node In case more than one node matches, it is not guaranteed that the first match is selected
        Parameters:
        localNames - one or more LocalNames
        Returns:
        the text content of the matching node or null when no matching node could be found
      • getAllNodes

        public java.util.stream.Stream<org.w3c.dom.Node> getAllNodes​(java.lang.String... localNames)
        Get all matching nodes
        Parameters:
        localNames - one or more LocalNames
        Returns:
        a Stream that contains all matching nodes (can be empty if nothing matches)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object