DaftIeDocument extends XmlConvertableDocument<Daft, DaftIeVersion> { @Override public DaftIeVersion getDocumentVersion() { String version; try { Document doc = this.getDocument(); version = StringUtils.trimToNull(XmlUtils .newXPath("/io:daft/@version", doc) .stringValueOf(doc)); if (version == null) { LOGGER.warn("Can't find version information in the XML document!"); return null; } } catch (JaxenException ex) { LOGGER.error("Can't evaluate XPath expression!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); return null; } DaftIeVersion v = DaftIeVersion.detectFromString(version); if (v != null) return v; LOGGER.warn("The provided version (" + version + ") is not supported!"); return null; } 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 testGetDocumentVersion() { DaftIeDocument doc; try { doc = new DaftIeDocument(buildExampleDocument("2.7")); Assert.assertEquals("2.7", DaftIeVersion.V2_7, doc.getDocumentVersion()); } catch (Exception ex) { LOGGER.error("Test of DaftIeDocument.getDocumentVersion failed!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); Assert.fail("Test of DaftIeDocument.getDocumentVersion failed!"); } }