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

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

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

Encoder.setSchemaLocation介绍

[英]Sets the schema location for a particular namespace uri.

Registering a schema location will include it on the "schemaLocation" attribute of the root element of the encoding.
[中]设置特定命名空间uri的架构位置。
注册模式位置将在编码根元素的“schemaLocation”属性中包含它。

代码示例

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

@Override
protected void setAdditionalSchemaLocations(
    Encoder encoder, GetFeatureRequest request, WFSInfo wfs) {
  // since wfs 2.0 schema does not depend on gml 3.2 schema we register it manually
  String loc =
      wfs.isCanonicalSchemaLocation()
          ? GML.CANONICAL_SCHEMA_LOCATION
          : ResponseUtils.buildSchemaURL(request.getBaseUrl(), "gml/3.2.1/gml.xsd");
  encoder.setSchemaLocation(GML.NAMESPACE, loc);
}

代码示例来源:origin: org.geoserver/wfsv

encoder.setSchemaLocation(org.geoserver.wfsv.xml.v1_1_0.WFSV.NAMESPACE,
    ResponseUtils.appendPath(proxifiedBaseUrl,
        "schemas/wfs/1.1.0/wfs.xsd"));
  encoder.setSchemaLocation(namespaceURI, ResponseUtils
      .appendQueryString(proxifiedBaseUrl + "wfs",
          "service=WFSV&version=1.1.0&request=DescribeVersionedFeatureType&typeName="

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

void write1_1(LockFeatureResponseType lockResponse, OutputStream output, Operation operation)
      throws IOException {
    Encoder encoder = new Encoder(configuration, configuration.schema());
    encoder.setEncoding(Charset.forName(getInfo().getGeoServer().getSettings().getCharset()));

    LockFeatureType req = (LockFeatureType) operation.getParameters()[0];

    encoder.setSchemaLocation(
        org.geoserver.wfs.xml.v1_1_0.WFS.NAMESPACE,
        buildSchemaURL(req.getBaseUrl(), "schemas/wfs/1.1.0/wfs.xsd"));

    encoder.encode(lockResponse, org.geoserver.wfs.xml.v1_1_0.WFS.LOCKFEATURERESPONSE, output);
    output.flush();
  }
}

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

@Override
  protected void encode(FeatureCollectionResponse hits, OutputStream output, WFSInfo wfs)
      throws IOException {
    hits.setNumberOfFeatures(BigInteger.valueOf(0));
    Encoder e = new Encoder(new WFSConfiguration());
    e.setEncoding(Charset.forName(wfs.getGeoServer().getSettings().getCharset()));
    e.setSchemaLocation(
        WFS.NAMESPACE, ResponseUtils.appendPath(wfs.getSchemaBaseURL(), "wfs/2.0/wfs.xsd"));

    e.encode(hits.getAdaptee(), WFS.FeatureCollection, output);
  }
}

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

protected void encode(FeatureCollectionResponse hits, OutputStream output, WFSInfo wfs)
      throws IOException {
    Encoder encoder = new Encoder(configuration, configuration.schema());
    encoder.setEncoding(Charset.forName(wfs.getGeoServer().getSettings().getCharset()));
    encoder.setSchemaLocation(
        org.geoserver.wfs.xml.v1_1_0.WFS.NAMESPACE,
        ResponseUtils.appendPath(wfs.getSchemaBaseURL(), "wfs/1.1.0/wfs.xsd"));

    encoder.encode(
        hits.getAdaptee(), org.geoserver.wfs.xml.v1_1_0.WFS.FEATURECOLLECTION, output);
  }
}

代码示例来源:origin: org.geoserver/wfsv

encoder.setSchemaLocation(org.geoserver.wfs.xml.v1_1_0.WFS.NAMESPACE,
  ResponseUtils.appendPath(wfs.getSchemaBaseURL(), "wfs/1.1.0/wfs.xsd"));
  encoder.setSchemaLocation(namespaceURI,
    ResponseUtils.appendQueryString(wfs.getOnlineResource().toString(),
      "service=WFS&version=1.1.0&request=DescribeFeatureType&typeName="

代码示例来源:origin: org.geoserver/wcs1_1

encoder.setLineWidth(60);
encoder.setSchemaLocation(OWS.NAMESPACE,
  RequestUtils.schemaBaseURL(request.getHttpRequest()) + "ows/1.1.0/owsAll.xsd");

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

encoder.setSchemaLocation(
    org.geoserver.wfs.xml.v1_1_0.WFS.NAMESPACE,
    buildSchemaURL(gft.getBaseUrl(), "wfs/1.0.0/WFS-basic.xsd"));
  encoder.setSchemaLocation(
      namespaceURI, buildURL(gft.getBaseUrl(), "wfs", params, URLType.RESOURCE));

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

encoder.setSchemaLocation(getWfsNamespace(), getCanonicalWfsSchemaLocation());
} else {
  encoder.setSchemaLocation(
      getWfsNamespace(),
      buildSchemaURL(request.getBaseURL(), getRelativeWfsSchemaLocation()));
        Map<String, String> schemaURIs = (Map<String, String>) userSchemaLocation;
        for (String namespace : schemaURIs.keySet()) {
          encoder.setSchemaLocation(namespace, schemaURIs.get(namespace));
            + ". Using a built schema location by default: "
            + schemaLocation);
    encoder.setSchemaLocation(namespaceURI, schemaLocation);

代码示例来源:origin: org.n52.wps/52n-wps-io-geotools

encoder.setSchemaLocation("http://www.opengis.net/gml", "http://schemas.opengis.net/gml/3.1.1/base/feature.xsd");
encoder.setSchemaLocation("http://www.opengis.net/gml http://schemas.opengis.net/gml/3.1.1/base/feature.xsd", namespace + " " + schemaLocation);

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

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

public void v_1_1(TransactionResponseType response, OutputStream output, Operation operation)
      throws IOException, ServiceException {
    if (!response.getTransactionResults().getAction().isEmpty()) {
      // since we do atomic transactions, an action failure means all we rolled back
      // spec says to throw exception
      ActionType action =
          (ActionType) response.getTransactionResults().getAction().iterator().next();
      throw new WFSException(action.getMessage(), action.getCode(), action.getLocator());
    }

    Encoder encoder = new Encoder(configuration, configuration.schema());
    encoder.setEncoding(Charset.forName(getInfo().getGeoServer().getSettings().getCharset()));

    TransactionType req = (TransactionType) operation.getParameters()[0];

    encoder.setSchemaLocation(
        org.geoserver.wfs.xml.v1_1_0.WFS.NAMESPACE,
        buildSchemaURL(req.getBaseUrl(), "wfs/1.1.0/wfs.xsd"));
    encoder.encode(response, org.geoserver.wfs.xml.v1_1_0.WFS.TRANSACTIONRESPONSE, output);
  }
}

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

encoder.setSchemaLocation(OWS.NAMESPACE, schemaLocation);

相关文章