org.geotools.xml.Encoder.setOmitXMLDeclaration()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(120)

本文整理了Java中org.geotools.xml.Encoder.setOmitXMLDeclaration()方法的一些代码示例,展示了Encoder.setOmitXMLDeclaration()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Encoder.setOmitXMLDeclaration()方法的具体详情如下:
包路径:org.geotools.xml.Encoder
类名称:Encoder
方法名:setOmitXMLDeclaration

Encoder.setOmitXMLDeclaration介绍

[英]Sets XML declaration omitting on and off.
[中]设置XML声明忽略打开和关闭。

代码示例

代码示例来源:origin: org.geotools/gt-wfs

/**
 * 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;
}

代码示例来源:origin: org.geotools/gt-wfs-ng

/**
 * 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;
}

代码示例来源:origin: org.geoserver/gs-wfs

e.setOmitXMLDeclaration(true);
  filter.append(e.encodeAsString(q.getFilter(), FES.Filter));
} catch (Exception e) {

代码示例来源:origin: org.geoserver/gs-wfs

@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);
}

代码示例来源:origin: org.geoserver/gs-wfs

Request dispatcherRequest = Dispatcher.REQUEST.get();
if (dispatcherRequest != null) {
  encoder.setOmitXMLDeclaration(dispatcherRequest.isSOAP());

代码示例来源:origin: org.geoserver/gs-wcs2_0

encoder.setIndentSize(2);
encoder.setLineWidth(60);
encoder.setOmitXMLDeclaration(request.isSOAP());

代码示例来源:origin: org.geoserver/gs-wcs2_0

/**
 * 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);
  }
}

相关文章