### Question:
DomUtils { public static void removeElements(final String xPath, final Element searchBase) { for (final Element elementToDelete : XmlUtils.findElements(xPath, searchBase)) { final Node parentNode = elementToDelete.getParentNode(); parentNode.removeChild(elementToDelete); removeTextNodes(parentNode); } } private  DomUtils(); static Element createChildElement(final String tagName, final Node parent,
      final Document document); static Element createChildIfNotExists(final String tagName, final Node parent,
      final Document document); static Element findFirstElementByName(final String name, final Element root); static Element getChildElementByTagName(final Element element,
      final String childElementName); static List<Element> getChildElementsByTagName(final Element element,
      final String childEleName); static List<Element> getChildElementsByTagName(final Element element,
      final String[] childElementNames); static String getChildElementValueByTagName(final Element element,
      final String childElementName); static String getChildTextContent(final Element parent, final String child); static String getTextContent(final Node node, final String defaultValue); static String getTextValue(final Element valueElement); static boolean nodeNameEquals(final Node node, final String desiredName); static void removeElements(final String xPath, final Element searchBase); static void removeTextNodes(final Node node);  }### Answer:
@Test public void testRemoveElements() throws Exception { final Element root = XmlUtils.stringToElement(XML_BEFORE_REMOVAL); final Element middle = DomUtils.getChildElementByTagName(root, "middle"); DomUtils.removeElements("bottom", middle); assertEquals(XmlUtils.nodeToString(XmlUtils.stringToElement(XML_AFTER_REMOVAL)), XmlUtils.nodeToString(root)); }