/** * Default parser used to decode an XML response. * @see ContentType#XML * @see XmlSlurper#parse(Reader) * @param resp HTTP response from which to parse content * @return the {@link GPathResult} from calling {@link XmlSlurper#parse(Reader)} * @throws IOException * @throws SAXException * @throws ParserConfigurationException */ public GPathResult parseXML( HttpResponse resp ) throws IOException, SAXException, ParserConfigurationException { XmlSlurper xml = new XmlSlurper(); xml.setEntityResolver( catalogResolver ); return xml.parse( parseText( resp ) ); }
/** * Default parser used to decode an XML response. * @see ContentType#XML * @see XmlSlurper#parse(Reader) * @param resp HTTP response from which to parse content * @return the {@link GPathResult} from calling {@link XmlSlurper#parse(Reader)} * @throws IOException * @throws SAXException * @throws ParserConfigurationException */ public GPathResult parseXML( HttpResponse resp ) throws IOException, SAXException, ParserConfigurationException { XmlSlurper xml = new XmlSlurper(); xml.setEntityResolver( catalogResolver ); return xml.parse( parseText( resp ) ); }
/** * Standard parser for xml responses. * * @param fromServer Backend indenpendent representation of data returned from http server * @return Body of response */ public static GPathResult xml(final ChainedHttpConfig config, final FromServer fromServer) { try { final XmlSlurper xml = new XmlSlurper(); xml.setEntityResolver(catalogResolver); xml.setFeature("http://apache.org/xml/features/disallow-doctype-decl", false); xml.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); return xml.parse(new InputStreamReader(fromServer.getInputStream(), fromServer.getCharset())); } catch (IOException | SAXException | ParserConfigurationException ex) { throw new RuntimeException(ex); } }
/** * Standard parser for xml responses. * * @param fromServer Backend indenpendent representation of data returned from http server * @return Body of response */ public static GPathResult xml(final ChainedHttpConfig config, final FromServer fromServer) { try { final XmlSlurper xml = new XmlSlurper(); xml.setEntityResolver(catalogResolver); xml.setFeature("http://apache.org/xml/features/disallow-doctype-decl", false); xml.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); return xml.parse(new InputStreamReader(fromServer.getInputStream(), fromServer.getCharset())); } catch (IOException | SAXException | ParserConfigurationException ex) { throw new TransportingException(ex); } }
/** * Standard parser for xml responses. * * @param fromServer Backend indenpendent representation of data returned from http server * @return Body of response */ public static GPathResult xml(final ChainedHttpConfig config, final FromServer fromServer) { try { final XmlSlurper xml = new XmlSlurper(); xml.setEntityResolver(catalogResolver); xml.setFeature("http://apache.org/xml/features/disallow-doctype-decl", false); xml.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); return xml.parse(new InputStreamReader(fromServer.getInputStream(), fromServer.getCharset())); } catch (IOException | SAXException | ParserConfigurationException ex) { throw new TransportingException(ex); } }