DaftIeDocument extends XmlConvertableDocument<Daft, DaftIeVersion> { @Override public void setDocumentVersion(DaftIeVersion version) { try { Document doc = this.getDocument(); Element node = (Element) XmlUtils .newXPath("/io:daft", doc) .selectSingleNode(doc); if (node == null) { LOGGER.warn("Can't find an <daft> element in the document!"); return; } node.setAttribute("version", version.toReadableVersion()); } catch (JaxenException ex) { LOGGER.error("Can't evaluate XPath expression!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); } } DaftIeDocument(Document document); @Override DaftIeVersion getDocumentVersion(); @Override DaftIeVersion getLatestVersion(); static boolean isReadable(Document doc); static DaftIeDocument newDocument(); static DaftIeDocument newDocument(Daft daft); @Override void setDocumentVersion(DaftIeVersion version); @Override Daft toObject();  }
@Test public void testSetDocumentVersion() { try { DaftIeDocument doc = new DaftIeDocument(buildExampleDocument("")); Assert.assertNull("no version", doc.getDocumentVersion()); doc.setDocumentVersion(DaftIeVersion.V2_7); Assert.assertEquals("2.7", DaftIeVersion.V2_7, doc.getDocumentVersion()); } catch (Exception ex) { LOGGER.error("Test of DaftIeDocument.setDocumentVersion failed!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); Assert.fail("Test of DaftIeDocument.setDocumentVersion failed!"); } }