@Test public void extractElementValue() throws PropertyEnricherException { String response = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle=\"http: assertThat(XmlUtil.extractName(response, "valid_AphiaID"), is("726834")); assertThat(XmlUtil.extractName(response, "valid_name"), is("Lecithochirium concavovesiculus")); }
public static String extractName(String xmlContent, String elementName) throws PropertyEnricherException { try { return extractName(IOUtils.toInputStream(xmlContent, "UTF-8"), elementName); } catch (Exception e) { throw new PropertyEnricherException("failed to handle response [" + xmlContent + "]", e); } }
XmlUtil { public static String extractName(String xmlContent, String elementName) throws PropertyEnricherException { try { return extractName(IOUtils.toInputStream(xmlContent, "UTF-8"), elementName); } catch (Exception e) { throw new PropertyEnricherException("failed to handle response [" + xmlContent + "]", e); } } }
XmlUtil { public static String extractName(String xmlContent, String elementName) throws PropertyEnricherException { try { return extractName(IOUtils.toInputStream(xmlContent, "UTF-8"), elementName); } catch (Exception e) { throw new PropertyEnricherException("failed to handle response [" + xmlContent + "]", e); } }  }
XmlUtil { public static String extractName(String xmlContent, String elementName) throws PropertyEnricherException { try { return extractName(IOUtils.toInputStream(xmlContent, "UTF-8"), elementName); } catch (Exception e) { throw new PropertyEnricherException("failed to handle response [" + xmlContent + "]", e); } }  static String extractPath(String xmlContent, String elementName, String valuePrefix); static List<String> extractPathNoJoin(String xmlContent, String elementName, String valuePrefix); static String extractPath(String xmlContent, String elementName, String valuePrefix, String valueSuffix); static List<String> extractPathNoJoin(String xmlContent, String elementName, String valuePrefix, String valueSuffix); static String extractName(String xmlContent, String elementName); static String extractName(InputStream is, String elementName); static Object applyXPath(InputStream is, String xpathExpr, QName qname); static Object applyXPath(Node node, String xpathExpr, QName qname); }
XmlUtil { public static String extractName(String xmlContent, String elementName) throws PropertyEnricherException { try { return extractName(IOUtils.toInputStream(xmlContent, "UTF-8"), elementName); } catch (Exception e) { throw new PropertyEnricherException("failed to handle response [" + xmlContent + "]", e); } }  static String extractPath(String xmlContent, String elementName, String valuePrefix); static List<String> extractPathNoJoin(String xmlContent, String elementName, String valuePrefix); static String extractPath(String xmlContent, String elementName, String valuePrefix, String valueSuffix); static List<String> extractPathNoJoin(String xmlContent, String elementName, String valuePrefix, String valueSuffix); static String extractName(String xmlContent, String elementName); static String extractName(InputStream is, String elementName); static Object applyXPath(InputStream is, String xpathExpr, QName qname); static Object applyXPath(Node node, String xpathExpr, QName qname);  }