org.eclipse.xsd.util
Interface XSDSchemaLocator

All Known Implementing Classes:
XSDResourceImpl.SchemaLocator

public interface XSDSchemaLocator

An adapter interface used by XSDSchemaDirective to find referenced schemas. When the schema referenced by a schema directive needs to be determined, the containing Resource will be inspected for an adapter that implements this interface. As such, you can register an adapter factory like this to tailor the algorithm used to locate a schema:

  ResourceSet resourceSet = new ResourceSetImpl();
  resourceSet.getAdapterFactories().add
    (new AdapterFactoryImpl()
     {
       class SchemaLocator extends AdapterImpl implements XSDSchemaLocator
       {
         public XSDSchema locateSchema(XSDSchema xsdSchema, String namespaceURI,  String rawSchemaLocationURI, String resolvedSchemaLocation)
         {
           return null;  // Additional logic...
         }

         public boolean isAdatperForType(Object type)
         {
           return type == XSDSchemaLocator.class;
         }
       }

       protected SchemaLocator schemaLocator = new SchemaLocator();

       public boolean isFactoryForType(Object type)
       {
         return type == XSDSchemaLocator.class;
       }

       public Adapter adaptNew(Notifier target, Object type)
       {
         return schemaLocator;
       }
     });

See Also:
EcoreUtil.getRegisteredAdapter(org.eclipse.emf.ecore.resource.Resource,Object)

Method Summary
 XSDSchema locateSchema(XSDSchema xsdSchema, java.lang.String namespaceURI, java.lang.String rawSchemaLocationURI, java.lang.String resolvedSchemaLocationURI)
          Locate the schema for the given namespace.
 

Method Detail

locateSchema

XSDSchema locateSchema(XSDSchema xsdSchema,
                       java.lang.String namespaceURI,
                       java.lang.String rawSchemaLocationURI,
                       java.lang.String resolvedSchemaLocationURI)
Locate the schema for the given namespace.

Parameters:
xsdSchema - the schema containing the namespace reference.
namespaceURI - the namespace being resolved, i.e., XSDImport.getNamespace().
rawSchemaLocationURI - the suggested location of the namespace being resolved, i.e., XSDSchemaDirective.getSchemaLocation().
resolvedSchemaLocationURI - the resolved suggested location of the namespace.
Returns:
the resolved schema.
See Also:
XSDSchemaLocationResolver.resolveSchemaLocation(XSDSchema, String, String), XSDConstants.resolveSchemaLocation(String,String,String)

Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.