PomWrapper { public Element clear(String xpath) { Element elem = selectElement(xpath); if (elem != null) DomUtil.removeAllChildren(elem); return elem; } PomWrapper(Document dom);  PomWrapper(File file); Document getDom(); void setDom(Document dom); String selectValue(String xpath); String selectValue(Node node, String xpath); Element selectElement(String xpath); Element selectElement(Node node, String xpath); List<Element> selectElements(String... paths); List<Element> selectElements(Node node, String... paths); Element selectOrCreateElement(String xpath); Element clear(String xpath); Map<String,String> getProperties(); String getProperty(String name); void setProperty(String name, String value); void deleteProperty(String name); String resolveProperties(String src); Artifact getGAV(); Artifact getParent(); @Override String toString(); List<Element> filterByGroupAndArtifact(List<Element> elements, String withGroupId, String withArtifactId);  }
@Test public void testClear() throws Exception { PomWrapper wrapper = new PomWrapper(ParseUtil.parseFromClasspath("PomWrapper1.xml")); Element propElem = wrapper.clear("/mvn:project/mvn:properties"); assertEquals("element name", "properties", DomUtil.getLocalName(propElem)); assertEquals("number of children", 0, propElem.getChildNodes().getLength()); }