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

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

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

Encoder.encodeAsString介绍

暂无

代码示例

代码示例来源: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

Encoder e = new Encoder(new FESConfiguration());
  e.setOmitXMLDeclaration(true);
  filter.append(e.encodeAsString(q.getFilter(), FES.Filter));
} catch (Exception e) {
  throw new RuntimeException("Unable to encode filter " + f, e);

代码示例来源: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);
  }
}

相关文章