@Override public Node apply(String s) { return XmlUtil.asXml(s); } });
/** * Converts the given string to an XML element. * * @param xml The XML string to be converted * @return The converted element */ public static Element asXml(String xml) { try { return DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(xml.getBytes("UTF-8"))).getDocumentElement(); } catch (IOException e) { return throwRuntimeXmlParseException(xml, e); } catch (SAXException e) { return throwRuntimeXmlParseException(xml, e); } catch (ParserConfigurationException e) { return throwRuntimeXmlParseException(xml, e); } }
/** * Converts the given string to an XML element. * * @param xml The XML string to be converted * @return The converted element */ public static Element asXml(String xml) { try { return DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(xml.getBytes("UTF-8"))).getDocumentElement(); } catch (IOException e) { return throwRuntimeXmlParseException(xml, e); } catch (SAXException e) { return throwRuntimeXmlParseException(xml, e); } catch (ParserConfigurationException e) { return throwRuntimeXmlParseException(xml, e); } }
@Override public Node apply(String s) { return XmlUtil.asXml(s); } });
/** * Converts a string to an XML element. * * @param content The content to be converted * @return The converted element * @deprecated Instead of doing asXml(response.getContent()) you can now do asXml(response). */ @Deprecated public static Element asXml(String content) { return XmlUtil.asXml(content); }
/** * Converts a string to an XML element. * * @param content The content to be converted * @return The converted element * @deprecated Instead of doing asXml(response.getContent()) you can now do asXml(response). */ @Deprecated public static Element asXml(String content) { return XmlUtil.asXml(content); }
/** * Converts the body of the given Response to an XML element. * * @param response The response to be converted * @return The converted element */ public static Element asXml(Response response) { return XmlUtil.asXml(response.getContent()); }
@Override public Element asXml() { return XmlUtil.asXml(this.getContent()); }
/** * Converts the body of the given Response to an XML element. * * @param response The response to be converted * @return The converted element */ public static Element asXml(Response response) { return XmlUtil.asXml(response.getContent()); }
@Override public Element asXml() { return XmlUtil.asXml(this.getContent()); }