org.geotools.xsd.XSD类的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(140)

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

XSD介绍

[英]Xml Schema for a particular namespace.

This class should is subclasses for the xs, gml, filter, sld, etc... schemas. Subclasses should be implemented as singletons.
[中]

代码示例

代码示例来源:origin: geoserver/geoserver

@Override
public void write(Object value, OutputStream output, Operation operation)
    throws IOException, ServiceException {
  try {
    Configuration c = (Configuration) xmlConfiguration.newInstance();
    Encoder e = new Encoder(c);
    for (Map.Entry<String, String> entry : getSchemaLocations().entrySet()) {
      e.setSchemaLocation(entry.getKey(), entry.getValue());
    }
    configureEncoder(e, elementName, xmlConfiguration);
    e.encode(value, new QName(c.getXSD().getNamespaceURI(), elementName), output);
  } catch (Exception e) {
    throw (IOException) new IOException().initCause(e);
  }
}

代码示例来源:origin: geotools/geotools

public boolean canHandle(
      XSDSchema schema,
      String namespaceURI,
      String rawSchemaLocationURI,
      String resolvedSchemaLocationURI) {
    return xsd.getNamespaceURI().equals(namespaceURI)
        && xsd.getSchemaLocation().equals(resolvedSchemaLocationURI);
  }
};

代码示例来源:origin: geoserver/geoserver

/** Adds a dependency on the xlink schema. */
protected void addDependencies(Set dependencies) {
  super.addDependencies(dependencies);
  dependencies.add(XLINK.getInstance());
}

代码示例来源:origin: geotools/geotools

/** Returns the XSD object representing the contents of the schema. */
public final XSDSchema getSchema() throws IOException {
  if (schema == null) {
    synchronized (this) {
      if (schema == null) {
        LOGGER.fine("building schema for schema: " + getNamespaceURI());
        schema = buildSchema();
      }
    }
  }
  return schema;
}

代码示例来源:origin: geotools/geotools

protected List allDependencies() {
  LinkedList unpacked = new LinkedList();
  Stack stack = new Stack();
  stack.addAll(getDependencies());
  while (!stack.isEmpty()) {
    XSD xsd = (XSD) stack.pop();
    if (!equals(xsd) && !unpacked.contains(xsd)) {
      unpacked.addFirst(xsd);
      stack.addAll(xsd.getDependencies());
    }
  }
  return unpacked;
}

代码示例来源:origin: geotools/geotools

List<XSD> deps = xsd.getAllDependencies();
deps.add(xsd);
  String uri = locations[i];
  for (XSD dep : deps) {
    if (dep.getNamespaceURI().equals(uri)) {
      locations[i + 1] = dep.getSchemaLocation();

代码示例来源:origin: geotools/geotools

public XSDSchema locateSchema(XSDSchema schema, String namespaceURI,
  String rawSchemaLocationURI, String resolvedSchemaLocationURI) {
  
  for ( Iterator x = xsds.iterator(); x.hasNext(); ) {
    XSD xsd = (XSD) x.next();
    if ( xsd == null ) {
      continue;
    }
    if ( xsd.getNamespaceURI().equals( namespaceURI ) ) {
      try {
        return xsd.getSchema();
      } 
      catch (IOException e) {
        getLog().warn("Error occured locating schema: " + namespaceURI, e);
      }
    }
  }
   getLog().warn( "Could not locate schema for: " + namespaceURI );
  return null;
}

代码示例来源:origin: geotools/geotools

List resolvers = new ArrayList();
for (Iterator d = allDependencies().iterator(); d.hasNext(); ) {
  XSD dependency = (XSD) d.next();
  SchemaLocator locator = dependency.createSchemaLocator();
  SchemaLocationResolver resolver = dependency.createSchemaLocationResolver();
XSDSchemaLocator suppSchemaLocator = getSupplementarySchemaLocator();
SchemaLocationResolver resolver = createSchemaLocationResolver();
return Schemas.parse(getSchemaLocation(), locators, resolvers);

代码示例来源:origin: geotools/geotools

if (gml.qName("boundedBy")
    .equals(new QName(attribute.getTargetNamespace(), attribute.getName()))) {
  BoundingBox bounds = getBoundedBy(feature, configuration);
  if (gml.getNamespaceURI().equals(attribute.getTargetNamespace())) {
    for (int j = i + 1; j < particles.size(); j++) {
      XSDParticle particle2 = (XSDParticle) particles.get(j);

代码示例来源:origin: geotools/geotools

/**
 * Convenience method for creating an instance of the schema for this configuration.
 *
 * @return The schema for this configuration.
 * @deprecated use {@link #getXSD()} and {@link XSD#getSchema()}.
 */
public XSDSchema schema() {
  try {
    return getXSD().getSchema();
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: geotools/geotools

/**
 * Returns the url to the file defining the schema.
 *
 * <p>For schema which are defined by multiple files, this method should return the base schema
 * which includes all other files that define the schema.
 *
 * @deprecated use {@link XSD#getSchemaLocation()}.
 */
public final String getSchemaFileURL() {
  return getXSD().getSchemaLocation();
}

代码示例来源:origin: geotools/geotools

@Override
  protected XSDSchema buildSchema() throws IOException {
    XSDSchema schema = super.buildSchema();

    schema.resolveElementDeclaration(NAMESPACE, "_Feature")
        .eAdapters()
        .add(new SubstitutionGroupLeakPreventer());
    schema.eAdapters().add(new ReferencingDirectiveLeakPreventer());
    return schema;
  }
}

代码示例来源:origin: geotools/geotools

/**
 * Transitively returns the type mapping profile for this schema and all schemas that this
 * schema depends on.
 */
public final List<Schema> getAllTypeMappingProfiles() {
  LinkedList profiles = new LinkedList();
  for (XSD xsd : getAllDependencies()) {
    Schema profile = xsd.getTypeMappingProfile();
    if (!profile.isEmpty()) {
      profiles.add(profile);
    }
  }
  return profiles;
}

代码示例来源:origin: geotools/geotools

for (Iterator d = configuration.getXSD().getDependencies().iterator(); d.hasNext(); ) {
    XSD xsd = (XSD) d.next();
    XSDSchema schema = xsd.getSchema();
  mappings.putAll(configuration.getXSD().getSchema().getQNamePrefixToNamespaceMap());
} catch (IOException e) {
  throw new RuntimeException(e);

代码示例来源:origin: geotools/geotools

public PropertyValueCollection(
    FeatureCollection delegate, AttributeDescriptor descriptor, PropertyName propName) {
  this.delegate = delegate;
  this.descriptor = descriptor;
  this.typeMappingProfiles.add(XS.getInstance().getTypeMappingProfile());
  this.typeMappingProfiles.add(GML.getInstance().getTypeMappingProfile());
  this.propertyName = propName;
  // fallback for gml:id "property"
  if (descriptor == null) {
    this.descriptor = ID_DESCRIPTOR;
  }
}

代码示例来源:origin: geotools/geotools

/**
 * Creates the schema, returning <code>null</code> if the schema could not be created. <code>
 * namespaceURI</code> should not be <code>null</code>. All other parameters are ignored.
 *
 * @see XSDSchemaLocator#locateSchema(org.eclipse.xsd.XSDSchema, java.lang.String,
 *     java.lang.String, java.lang.String)
 */
public XSDSchema locateSchema(
    XSDSchema schema,
    String namespaceURI,
    String rawSchemaLocationURI,
    String resolvedSchemaLocationURI) {
  if (canHandle(schema, namespaceURI, rawSchemaLocationURI, resolvedSchemaLocationURI)) {
    try {
      return xsd.getSchema();
    } catch (IOException e) {
      LOGGER.log(Level.WARNING, "Error occured getting schema", e);
    }
  }
  return null;
}

代码示例来源:origin: geotools/geotools

throw new RuntimeException(
    "Unsupported GML version for schema at "
        + configuration.getXSD().getSchemaLocation());

代码示例来源:origin: geotools/geotools

@Override
  protected XSDSchema buildSchema() throws IOException {
    XSDSchema schema = super.buildSchema();

    schema.resolveElementDeclaration(NAMESPACE, "_Feature")
        .eAdapters()
        .add(new SubstitutionGroupLeakPreventer());
    schema.eAdapters().add(new ReferencingDirectiveLeakPreventer());
    return schema;
  }
}

代码示例来源:origin: geotools/geotools

private Class mapTypeName(String typeName) {
    // try xs simple type
    Schema xsTypeMappingProfile = XS.getInstance().getTypeMappingProfile();
    NameImpl name = new NameImpl(XS.NAMESPACE, typeName);
    if (xsTypeMappingProfile.containsKey(name)) {
      AttributeType type = xsTypeMappingProfile.get(name);
      if (type.getBinding() != null) {
        return type.getBinding();
      }
    }

    // try gml geometry types
    Geometries g = Geometries.getForName(typeName);
    if (g != null) {
      return g.getBinding();
    }

    // default
    return String.class;
  }
}

代码示例来源:origin: geotools/geotools

public String toString() {
  return getNamespaceURI();
}

相关文章