Class XMLUtils

java.lang.Object
org.pepsoft.util.XMLUtils

public final class XMLUtils extends Object
Utility methods for working with XML APIs.
  • Method Details

    • forEachElement

      public static <E extends Exception> void forEachElement(NodeList nodeList, XMLUtils.ElementVisitor<E> visitor) throws E
      Visit each element in a node list. This method assumes that every node is an Element, otherwise it will throw a ClassCastException.
      Parameters:
      nodeList - The node list over which to iterate.
      visitor - The visitor to invoke for each element on the node list.
      Throws:
      ClassCastException - If not all nodes on the list are an Element.
      E - If the visitor throws a checked exception of the specified or inferred type.