/** * Returns a single-line string containing the xml representation of the given filter, as * appropriate for the {@code FILTER} parameter in a GetFeature request. */ protected String encodeGetFeatureGetFilter(final Filter filter) throws IOException { Configuration filterConfig = getFilterConfiguration(); Encoder encoder = new Encoder(filterConfig); // do not write the xml declaration encoder.setOmitXMLDeclaration(true); encoder.setEncoding(Charset.forName("UTF-8")); OutputStream out = new ByteArrayOutputStream(); encoder.encode(filter, OGC.Filter, out); String encoded = out.toString(); encoded = encoded.replaceAll("\n", ""); return encoded; }
/** * Returns a single-line string containing the xml representation of the given filter, as * appropriate for the {@code FILTER} parameter in a GetFeature request. */ protected String encodeGetFeatureGetFilter(final Filter filter) throws IOException { final Configuration filterConfig = getFilterConfiguration(); final QName encName; if (filterConfig instanceof org.geotools.filter.v1_0.OGCConfiguration || filterConfig instanceof org.geotools.filter.v1_1.OGCConfiguration) { encName = org.geotools.filter.v1_0.OGC.Filter; } else { encName = org.geotools.filter.v2_0.FES.Filter; } Encoder encoder = new Encoder(filterConfig); // do not write the xml declaration encoder.setOmitXMLDeclaration(true); encoder.setEncoding(Charset.forName("UTF-8")); String encoded = encoder.encodeAsString(filter, encName); encoded = encoded.replaceAll("\n", ""); return encoded; }
e.setOmitXMLDeclaration(true); filter.append(e.encodeAsString(q.getFilter(), FES.Filter)); } catch (Exception e) {
@Override public void write(Object value, OutputStream output, Operation operation) throws IOException, ServiceException { Encoder encoder = new Encoder(new WFSConfiguration()); encoder.setEncoding(Charset.forName(getInfo().getGeoServer().getSettings().getCharset())); encoder.setOmitXMLDeclaration(Dispatcher.REQUEST.get().isSOAP()); String baseURL = (String) EMFUtils.get((EObject) operation.getParameters()[0], "baseUrl"); encoder.setSchemaLocation(WFS.NAMESPACE, buildSchemaURL(baseURL, "wfs/2.0/wfs.xsd")); encode(encoder, value, output, operation); }
Request dispatcherRequest = Dispatcher.REQUEST.get(); if (dispatcherRequest != null) { encoder.setOmitXMLDeclaration(dispatcherRequest.isSOAP());
encoder.setIndentSize(2); encoder.setLineWidth(60); encoder.setOmitXMLDeclaration(request.isSOAP());
/** * Returns the xml encoding of the created request. * * @param version * @throws IOException */ public String asXML(String version) throws IOException { if ("1.1.1".equals(version)) { Encoder encoder = new Encoder(new org.geotools.wcs.v1_1.WCSConfiguration()); encoder.setIndenting(true); encoder.setOmitXMLDeclaration(true); // prefix is set to 'null' if we don't declare it explicitly encoder.getNamespaces().declarePrefix("ows", "http://www.opengis.net/ows/1.1"); return encoder.encodeAsString(wcs111GetCoverage, org.geotools.wcs.v1_1.WCS.GetCoverage); } else { Encoder encoder = new Encoder(new WCSConfiguration()); encoder.setIndenting(true); encoder.setOmitXMLDeclaration(true); return encoder.encodeAsString(getCoverageType, WCS.GetCoverage); } }