org.eclipse.xsd.util.XSDSchemaLocationResolver类的使用及代码示例

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

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

XSDSchemaLocationResolver介绍

[英]An adapter interface used to resolve org.eclipse.xsd.XSDSchemaDirective#getSchemaLocation. When the schema location of an schema directive needs to be resolved, each containing org.eclipse.xsd.XSDSchema will be org.eclipse.emf.ecore.util.EcoreUtil#getRegisteredAdapter(org.eclipse.emf.ecore.EObject,Object) for an adapter that implements this interface. As such, you can register an adapter factory like this to tailor the algorithm used to resolve a schema location:

  1. ResourceSet resourceSet = new ResourceSetImpl();
  2. resourceSet.getAdapterFactories().add
  3. (new AdapterFactoryImpl()
  4. {
  5. class Resolver extends AdapterImpl implements XSDSchemaLocationResolver
  6. {
  7. public String resolveSchemaLocation(XSDSchema xsdSchema, String namespaceURI, String schemaLocationURI)
  8. {
  9. return XSDConstants.resolveSchemaLocation(xsdSchema.getSchemaLocation(), namespaceURI, schemaLocationURI);
  10. }
  11. public boolean isAdapterForType(Object type)
  12. {
  13. return type == XSDSchemaLocationResolver.class;
  14. }
  15. }
  16. protected Resolver resolver = new Resolver();
  17. public boolean isFactoryForType(Object type)
  18. {
  19. return type == XSDSchemaLocationResolver.class;
  20. }
  21. public Adapter adaptNew(Notifier target, Object type)
  22. {
  23. return resolver;
  24. }
  25. });

[中]用于解析组织的适配器接口。日食xsd。XSDSchemaDirective#getSchemaLocation。当需要解析schema指令的schema位置时,每个指令都包含org。日食xsd。XSDSchema将被组织起来。日食电动势。ecore。util。EcoreUtil#getRegisteredAdapter(org.eclipse.emf.ecore.EObject,Object),用于实现此接口的适配器。因此,您可以像这样注册适配器工厂,以定制用于解析架构位置的算法:

  1. ResourceSet resourceSet = new ResourceSetImpl();
  2. resourceSet.getAdapterFactories().add
  3. (new AdapterFactoryImpl()
  4. {
  5. class Resolver extends AdapterImpl implements XSDSchemaLocationResolver
  6. {
  7. public String resolveSchemaLocation(XSDSchema xsdSchema, String namespaceURI, String schemaLocationURI)
  8. {
  9. return XSDConstants.resolveSchemaLocation(xsdSchema.getSchemaLocation(), namespaceURI, schemaLocationURI);
  10. }
  11. public boolean isAdapterForType(Object type)
  12. {
  13. return type == XSDSchemaLocationResolver.class;
  14. }
  15. }
  16. protected Resolver resolver = new Resolver();
  17. public boolean isFactoryForType(Object type)
  18. {
  19. return type == XSDSchemaLocationResolver.class;
  20. }
  21. public Adapter adaptNew(Notifier target, Object type)
  22. {
  23. return resolver;
  24. }
  25. });

代码示例

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

  1. public String resolveSchemaLocation(
  2. XSDSchema schema, String namespaceURI, String rawSchemaLocationURI) {
  3. for (int i = 0; i < resolvers.size(); i++) {
  4. XSDSchemaLocationResolver resolver = (XSDSchemaLocationResolver) resolvers.get(i);
  5. String resolved =
  6. resolver.resolveSchemaLocation(schema, namespaceURI, rawSchemaLocationURI);
  7. if (resolved != null) {
  8. return resolved;
  9. }
  10. }
  11. if (LOGGER.isLoggable(Level.FINE)) {
  12. LOGGER.fine(
  13. "Could not resolve schema location: "
  14. + rawSchemaLocationURI
  15. + " to physical location.");
  16. }
  17. return null;
  18. }
  19. }

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

  1. resolver.resolveSchemaLocation(null, namespace, location);
  2. if (resolvedSchemaLocation != null) {
  3. return resolvedSchemaLocation;

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

  1. resolvers.get(j).resolveSchemaLocation(null, namespace, location);
  2. if (override != null) {

代码示例来源:origin: org.geotools/gt2-xml-core

  1. public String resolveSchemaLocation(XSDSchema schema, String namespaceURI,
  2. String rawSchemaLocationURI) {
  3. for (int i = 0; i < resolvers.size(); i++) {
  4. XSDSchemaLocationResolver resolver = (XSDSchemaLocationResolver) resolvers.get(i);
  5. String resolved = resolver.resolveSchemaLocation(schema, namespaceURI,
  6. rawSchemaLocationURI);
  7. if (resolved != null) {
  8. return resolved;
  9. }
  10. }
  11. if (LOGGER.isLoggable(Level.FINE)) {
  12. LOGGER.fine("Could not resolve schema location: " + rawSchemaLocationURI
  13. + " to physical location.");
  14. }
  15. return null;
  16. }
  17. }

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

  1. public String resolveSchemaLocation(XSDSchema schema, String namespaceURI,
  2. String rawSchemaLocationURI) {
  3. for (int i = 0; i < resolvers.size(); i++) {
  4. XSDSchemaLocationResolver resolver = (XSDSchemaLocationResolver) resolvers.get(i);
  5. String resolved = resolver.resolveSchemaLocation(schema, namespaceURI,
  6. rawSchemaLocationURI);
  7. if (resolved != null) {
  8. return resolved;
  9. }
  10. }
  11. if (LOGGER.isLoggable(Level.FINE)) {
  12. LOGGER.fine("Could not resolve schema location: " + rawSchemaLocationURI
  13. + " to physical location.");
  14. }
  15. return null;
  16. }
  17. }

代码示例来源:origin: org.geotools/gt2-xml-xsd

  1. public String resolveSchemaLocation(
  2. XSDSchema schema, String namespaceURI, String rawSchemaLocationURI
  3. ) {
  4. for (int i = 0; i < resolvers.size(); i++) {
  5. XSDSchemaLocationResolver resolver = (XSDSchemaLocationResolver) resolvers.get( i );
  6. String resolved =
  7. resolver.resolveSchemaLocation(schema, namespaceURI, rawSchemaLocationURI);
  8. if (resolved != null) {
  9. return resolved;
  10. }
  11. }
  12. if (rawSchemaLocationURI != null || rawSchemaLocationURI.startsWith("http://")
  13. || rawSchemaLocationURI.startsWith("file:")) {
  14. LOGGER.warning("Using the provided absolute URI as the location for namespace '"
  15. + namespaceURI
  16. + "', as it couldn't be resolved for the provided location path '"
  17. + rawSchemaLocationURI + "'");
  18. return rawSchemaLocationURI;
  19. }
  20. LOGGER.warning( "Could not resolve schema location: " + rawSchemaLocationURI + " to physical location." );
  21. return null;
  22. }
  23. }

代码示例来源:origin: org.geotools/gt2-xml-gml3

  1. /**
  2. * @return Url to the gml.xsd file of the gml3 schema.
  3. */
  4. public String getSchemaFileURL() {
  5. return getSchemaLocationResolver().resolveSchemaLocation(null, getNamespaceURI(), "gml.xsd");
  6. }

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

  1. /**
  2. * @return the uri to the the wfsv.xsd .
  3. * @generated
  4. */
  5. public String getSchemaFileURL() {
  6. return getSchemaLocationResolver().resolveSchemaLocation(null, getNamespaceURI(), "wfsv.xsd");
  7. }

代码示例来源:origin: org.geotools/gt2-xml-xsd

  1. /**
  2. * @return The xlinks.xsd of the xlink schema.
  3. */
  4. public String getSchemaFileURL() {
  5. return getSchemaLocationResolver().resolveSchemaLocation( null, getNamespaceURI(), "xlinks.xsd" );
  6. }

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

  1. resolver.resolveSchemaLocation(null, namespace, location );
  2. if ( resolvedSchemaLocation != null ) {
  3. return resolvedSchemaLocation;

代码示例来源:origin: org.geotools/gt2-xml-gml3

  1. /**
  2. * @return URL to smil20-language.xsd file of schema.
  3. */
  4. public String getSchemaFileURL() {
  5. return getSchemaLocationResolver()
  6. .resolveSchemaLocation(null, getNamespaceURI(), "smil20-language.xsd");
  7. }

代码示例来源:origin: org.geotools/gt2-wms

  1. /**
  2. * @return the uri to the the WMS_MS_Capabilitiesr2.xsd .
  3. * @generated
  4. */
  5. public String getSchemaFileURL() {
  6. return getSchemaLocationResolver().resolveSchemaLocation(
  7. null, getNamespaceURI(), "WMS_MS_Capabilities.xsd"
  8. );
  9. }

代码示例来源:origin: org.geotools/gt2-xml-filter

  1. /**
  2. * @return the filter.xsd file of the schema.
  3. */
  4. public String getSchemaFileURL() {
  5. return getSchemaLocationResolver()
  6. .resolveSchemaLocation(null, getNamespaceURI(), "filter.xsd");
  7. }

代码示例来源:origin: org.geotools/gt2-xml-filter

  1. /**
  2. * @return the filter.xsd file of the schema.
  3. */
  4. public String getSchemaFileURL() {
  5. return getSchemaLocationResolver()
  6. .resolveSchemaLocation(null, getNamespaceURI(), "filter.xsd");
  7. }

代码示例来源:origin: org.geotools/gt2-xml-gml3

  1. /**
  2. * @return URL to smil20.xsd file of schema.
  3. */
  4. public String getSchemaFileURL() {
  5. return getSchemaLocationResolver()
  6. .resolveSchemaLocation(null, getNamespaceURI(), "smil20.xsd");
  7. }

代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd

  1. if (xsdSchemaLocationResolver != null)
  2. return xsdSchemaLocationResolver.resolveSchemaLocation(xsdSchema, namespace, schemaLocation);

代码示例来源:origin: org.eclipse/org.eclipse.xsd

  1. if (xsdSchemaLocationResolver != null)
  2. return xsdSchemaLocationResolver.resolveSchemaLocation(xsdSchema, namespace, schemaLocation);

代码示例来源:origin: org.geotools/gt2-xml-core

  1. String override = resolvers[j].resolveSchemaLocation(null, namespace,
  2. location);

代码示例来源:origin: org.geotools/gt2-xml-xsd

  1. String override = resolvers[j].resolveSchemaLocation(null,
  2. namespace, location);

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

  1. String override = resolvers[j].resolveSchemaLocation(null, namespace,
  2. location);
  3. if (override != null) {

相关文章

XSDSchemaLocationResolver类方法