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

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

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

Encoder.encodeAsDOM介绍

暂无

代码示例

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

@Override
public Element marshal(MultiPolygon geometry) throws Exception {
  if (geometry == null) {
    return null;
  }
  try {
    Encoder encoder = new Encoder(new GMLConfiguration());
    return encoder.encodeAsDOM(geometry, org.geotools.gml3.v3_2.GML.MultiGeometry)
        .getDocumentElement();
  } catch (Exception e) {
    throw new Exception("Cannot transform the specified geometry in GML", e);
  }
}

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

dom = encoder.encodeAsDOM(requestObject, opName);
} catch (SAXException e) {
  throw new IOException(e);

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

@Override
protected void encode(FeatureCollectionResponse hits, OutputStream output, WFSInfo wfs)
    throws IOException {
  hits.setNumberOfFeatures(BigInteger.ZERO);
  // instantiate the XML encoder
  Encoder encoder = new Encoder(new WFSConfiguration());
  encoder.setEncoding(Charset.forName(wfs.getGeoServer().getSettings().getCharset()));
  encoder.setSchemaLocation(
      WFS.NAMESPACE, ResponseUtils.appendPath(wfs.getSchemaBaseURL(), "wfs/2.0/wfs.xsd"));
  Document document;
  try {
    // encode the HITS result using FeatureCollection as the root XML element
    document = encoder.encodeAsDOM(hits.getAdaptee(), WFS.FeatureCollection);
  } catch (Exception exception) {
    throw new RuntimeException("Error encoding INDEX result.", exception);
  }
  // add the resultSetID attribute to the result
  addResultSetIdElement(document, resultSetId);
  // write the XML document to response output stream
  writeDocument(document, output);
}

相关文章