OpenImmo_1_2_0 extends XmlConverter<OpenImmoDocument, OpenImmoVersion> { protected void downgradeUebertragungElements(Document doc) throws JaxenException { List nodes = XmlUtils.newXPath( "/io:openimmo/io:uebertragung[@senderversion or @regi_id or @modus]", doc).selectNodes(doc); for (Object item : nodes) { Element node = (Element) item; node.removeAttribute("senderversion"); node.removeAttribute("regi_id"); node.removeAttribute("modus"); } }  @Override OpenImmoVersion getVersion(); @Override void downgradeToPreviousVersion(OpenImmoDocument doc); @Override void upgradeFromPreviousVersion(OpenImmoDocument doc);  }
@Test public void testDowngradeUebertragungElements() { try { Document doc = buildTransferDocumentForDowngrade(); int count; count = XmlUtils.countNodes( "/io:openimmo/io:uebertragung[@senderversion or @regi_id or @modus]", doc); Assert.assertEquals( "1 convertable <uebertragung> element available before conversion.", 1, count); new OpenImmo_1_2_0().downgradeUebertragungElements(doc); count = XmlUtils.countNodes( "/io:openimmo/io:uebertragung[@senderversion or @regi_id or @modus]", doc); Assert.assertEquals( "0 convertable <uebertragung> elements available after conversion.", 0, count); } catch (Exception ex) { LOGGER.error("Test of OpenImmo_1_2_0.downgradeUebertragungElements failed!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); Assert.fail("Test of OpenImmo_1_2_0.downgradeUebertragungElements failed!"); } }