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

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

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

Encoder.getNamespaces介绍

[英]Returns the namespace mappings maintained by the encoder.

Clients may register additional namespace mappings. This is useful when an application whishes to provide some "default" namespace mappings.

Clients should register namespace mappings in the current "context", ie do not call NamespaceSupport#pushContext(). Example: Encoder parser = new Encoder( ... ); encoder.getNamespaces().declarePrefix( "foo", "http://www.foo.com" ); ...
[中]返回编码器维护的命名空间映射。
客户端可以注册其他命名空间映射。当应用程序需要提供一些“默认”名称空间映射时,这非常有用。
客户端应在当前“上下文”中注册命名空间映射,即不调用NamespaceSupport#pushContext()。示例:Encoder parser = new Encoder( ... ); encoder.getNamespaces().declarePrefix( "foo", "http://www.foo.com" ); ...

代码示例

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

@Override
  protected void configureEncoder(
      Encoder encoder, String elementName, Class<?> xmlConfiguration) {
    encoder.setNamespaceAware(true);
    encoder.getNamespaces().declarePrefix("ows", OWS.NAMESPACE);
    encoder.getNamespaces().declarePrefix("ogc", OGC.NAMESPACE);
    encoder.getNamespaces().declarePrefix("gml", "http://www.opengis.net/gml");
    encoder.getNamespaces().declarePrefix("gmd", "http://www.isotc211.org/2005/gmd");
    encoder.getNamespaces().declarePrefix("xlink", XLINK.NAMESPACE);
  }
}

代码示例来源:origin: org.geoserver.csw/csw-core

@Override
protected void configureEncoder(Encoder encoder, String elementName, Class xmlConfiguration) {
  encoder.setNamespaceAware(true);
  encoder.getNamespaces().declarePrefix("ows", OWS.NAMESPACE);
  encoder.getNamespaces().declarePrefix("ogc", OGC.NAMESPACE);
  encoder.getNamespaces().declarePrefix("gml", "http://www.opengis.net/gml");
  encoder.getNamespaces().declarePrefix("gmd", "http://www.isotc211.org/2005/gmd");
  encoder.getNamespaces().declarePrefix("xlink", XLINK.NAMESPACE);
}

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

@Override
  protected void encode(Encoder encoder, Object value, OutputStream output, Operation op)
      throws IOException, ServiceException {
    // check the returned types, they are qnames and we need to declare their prefixes
    ListStoredQueriesResponseType response = (ListStoredQueriesResponseType) value;
    for (StoredQueryListItemType sq : response.getStoredQuery()) {
      if (sq.getReturnFeatureType() != null) {
        for (QName qName : sq.getReturnFeatureType()) {
          if (qName.getNamespaceURI() != null && qName.getPrefix() != null) {
            encoder.getNamespaces()
                .declarePrefix(qName.getPrefix(), qName.getNamespaceURI());
          }
        }
      }
    }

    encoder.encode(value, WFS.ListStoredQueriesResponse, output);
  }
}

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

String uri = (String) mapping.getValue();
encoder.getNamespaces().declarePrefix( prefix, uri );

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

encoder.getNamespaces().declarePrefix(prefix, namespaceURI);

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

String namespace = fullName.getNamespaceURI();
if (!XMLConstants.DEFAULT_NS_PREFIX.equals(prefix)) {
  encoder.getNamespaces().declarePrefix(prefix, namespace);

代码示例来源:origin: org.geoserver.extension/gs-wps-core

@Override
public void encode(Object object, ContentHandler handler) throws Exception {
  FeatureCollection features = (FeatureCollection) object;
  SimpleFeatureType featureType = (SimpleFeatureType) features.getSchema();
  FeatureCollectionType fc = WfsFactory.eINSTANCE.createFeatureCollectionType();
  fc.getFeature().add(features);
  Encoder e = new Encoder(configuration);
  e.getNamespaces().declarePrefix("feature", featureType.getName().getNamespaceURI());
  e.encode(fc, getElement(), handler);
}

代码示例来源:origin: org.geoserver.extension/wps-core

@Override
public void encode(Object object, ContentHandler handler) throws Exception {
  FeatureCollection features = (FeatureCollection) object;
  SimpleFeatureType featureType = (SimpleFeatureType) features.getSchema();
  
  FeatureCollectionType fc = WfsFactory.eINSTANCE.createFeatureCollectionType();
  fc.getFeature().add( features );
  
  Encoder e = new Encoder(configuration);
  e.getNamespaces().declarePrefix( "feature", featureType.getName().getNamespaceURI() );
  e.encode( fc, getElement(), handler );
}

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

encoder.getNamespaces().declarePrefix(ns.getPrefix(), ns.getURI());
} else {
      if (encoder.getNamespaces().getURI(nameSpaceinfo.getPrefix()) == null) {
        encoder.getNamespaces()
            .declarePrefix(nameSpaceinfo.getPrefix(), nameSpaceinfo.getURI());

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

encoder.getNamespaces()
    .declarePrefix(ri.getStore().getWorkspace().getName(), namespaceURI);

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

相关文章