### Question:
EMLUtil { public static JsonNode datasetWithEML(ResourceService origDataset, URI emlURI) throws IOException { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(origDataset.retrieve(emlURI)); XPathFactory xPathfactory = XPathFactory.newInstance(); XPath xpath = xPathfactory.newXPath(); String collectionName = StringUtils.trim(getFirstIfPresent(doc, xpath, " String datasetTitle = StringUtils.trim(getFirstIfPresent(doc, xpath, " String name = StringUtils.isBlank(collectionName) ? datasetTitle : collectionName; String pubDate = StringUtils.trim(getFirstIfPresent(doc, xpath, " String citation = StringUtils.trim(getFirstIfPresent(doc, xpath, " ObjectNode objectNode = new ObjectMapper().createObjectNode(); String datasetCitation = Stream.of(name, pubDate,citation) .filter(StringUtils::isNotBlank) .collect(Collectors.joining(". ")); objectNode.put("citation", datasetCitation + "."); objectNode.put("format", MIME_TYPE_DWCA); String string = new ObjectMapper().writeValueAsString(objectNode); return new ObjectMapper().readTree(string); } catch (XPathExpressionException | ParserConfigurationException | IOException | SAXException e) { throw new IOException("failed to handle xpath", e); } }  static JsonNode datasetWithEML(ResourceService origDataset, URI emlURI);  }### Answer:
@Test public void metaToMetaTables() throws URISyntaxException, IOException { Dataset origDataset = new DatasetImpl("some/namespace", URI.create("some:uri"), inStream -> inStream); String uriString = "jar:" + getClass().getResource("dwca.zip").toURI().toString() + "!/vampire-moth-dwca-c4549a1690b84595c88946f477057b9ab76e5360/eml.xml"; JsonNode config = EMLUtil.datasetWithEML(origDataset, URI.create(uriString)); DatasetProxy proxy = new DatasetProxy(origDataset); proxy.setConfig(config); assertThat(proxy.getCitation(), is ("Occurrence Records for vampire-moths-and-their-fruit-piercing-relatives. 2018-09-27. South Central California Network - 2ba077c1-aa41-455e-9a84-bccb61a91230.")); assertThat(proxy.getFormat(), is (MIME_TYPE_DWCA)); }
@Test public void withEMLofINHS() throws URISyntaxException, IOException { Dataset origDataset = new DatasetImpl("some/namespace", URI.create("some:uri"), inStream -> inStream); URI emlURI = getClass().getResource("inhs-eml.xml").toURI(); JsonNode config = EMLUtil.datasetWithEML(origDataset, emlURI); DatasetProxy proxy = new DatasetProxy(origDataset); proxy.setConfig(config); assertThat(proxy.getFormat(), is (MIME_TYPE_DWCA)); assertThat(proxy.getCitation(), is ("Illinois Natural History Survey Insect Collection. 2018-02-28.")); }