OpenImmo_1_2_7b extends XmlConverter<OpenImmoDocument, OpenImmoVersion> { protected void removeReferenzIdElements(Document doc) throws JaxenException { List nodes = XmlUtils.newXPath( "/io:openimmo/io:anbieter/io:immobilie/io:kontaktperson/io:referenz_id", doc).selectNodes(doc); for (Object item : nodes) { Element node = (Element) item; Element parentNode = (Element) node.getParentNode(); parentNode.removeChild(node); } }  @Override OpenImmoVersion getVersion(); @Override void downgradeToPreviousVersion(OpenImmoDocument doc); @Override void upgradeFromPreviousVersion(OpenImmoDocument doc);  }
@Test public void testRemoveReferenzIdElements() { try { Document doc = buildTransferDocumentForDowngrade(); int count; count = XmlUtils.countNodes( "/io:openimmo/io:anbieter/io:immobilie/io:kontaktperson/io:referenz_id", doc); Assert.assertEquals( "3 <referenz_id> element available before conversion.", 3, count); new OpenImmo_1_2_7b().removeReferenzIdElements(doc); count = XmlUtils.countNodes( "/io:openimmo/io:anbieter/io:immobilie/io:kontaktperson/io:referenz_id", doc); Assert.assertEquals( "0 <referenz_id> elements available after conversion.", 0, count); } catch (Exception ex) { LOGGER.error("Test of OpenImmo_1_2_7b.removeReferenzIdElements failed!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); Assert.fail("Test of OpenImmo_1_2_7b.removeReferenzIdElements failed!"); } }