/** * Parses a SLD Style from a xml string * * @param sldBody the string containing the SLD document * @return the SLD document string parsed to a Style object * @throws WmsException if a parsing error occurs. */ private Style[] parseSldBody(String sldBody) throws ServiceException { // return parseSld(new StringBufferInputStream(sldBody)); return parseSld(new StringReader(sldBody)); }
/** * Loads a remote SLD document and parses it to a Style object * * @param sldUrl an URL to a SLD document * @return the document parsed to a Style object * @throws WmsException if <code>sldUrl</code> is not a valid URL, a stream can't be opened or a * parsing error occurs */ private Style[] loadRemoteStyle(String sldUrl) throws ServiceException { InputStream in; try { URL url = new URL(sldUrl); in = url.openStream(); } catch (MalformedURLException e) { throw new ServiceException( e, "Not a valid URL to an SLD document " + sldUrl, "loadRemoteStyle"); } catch (IOException e) { throw new ServiceException(e, "Can't open the SLD URL " + sldUrl, "loadRemoteStyle"); } return parseSld(new InputStreamReader(in)); }