org.eclipse.xsd.util
Interface XSDSchemaLocationResolver
- public interface XSDSchemaLocationResolver
An adapter interface used to resolve schema locations.
When the schema location of an schema directive needs to be resolved,
each containing schema
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 resolve a schema location:
ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getAdapterFactories().add
(new AdapterFactoryImpl()
{
class Resolver extends AdapterImpl implements XSDSchemaLocationResolver
{
public String resolveSchemaLocation(XSDSchema xsdSchema, String namespaceURI, String schemaLocationURI)
{
return XSDConstants.resolveSchemaLocation(xsdSchema.getSchemaLocation(), namespaceURI, schemaLocationURI);
}
};
protected Resolver resolver = new Resolver();
public boolean isFactoryForType(Object type)
{
return type == XSDSchemaLocationResolver.class;
}
public Adapter adaptNew(Notifier target, Object type)
{
return resolver;
}
});
|
Method Summary |
java.lang.String |
resolveSchemaLocation(XSDSchema xsdSchema,
java.lang.String namespaceURI,
java.lang.String schemaLocationURI)
Resolve the namespace and schema location relative to the given base schema's location. |
resolveSchemaLocation
public java.lang.String resolveSchemaLocation(XSDSchema xsdSchema,
java.lang.String namespaceURI,
java.lang.String schemaLocationURI)
- Resolve the namespace and schema location relative to the given base schema's location.
For example, the expression
resolveSchemaLocation
(xsdSchema, // xsdSchema.getSchemaLocation() == "http://www.example.com/A/a.xsd"
"http://www.example.com/B",
"../B/b.xsd");
would normally yield
"http://www.example.com/B/b.xsd"
When no namespace schema location is provided, the namespace itself will be used.
- Parameters:
xsdSchema - the schema containing the referencenamespaceURI - the namespace being resolved, i.e., XSDImport.getNamespace().schemaLocationURI - the suggested location of the namespace being resolved, i.e., XSDSchemaDirective.getSchemaLocation().- Returns:
- the resolved schema location.
- See Also:
XSDConstants.resolveSchemaLocation(String,String,String)
|
|
Copyright 2001-2003 IBM Corporation and others. All Rights Reserved.
|
|
PREV CLASS
SOURCE NEXT CLASS |
FRAMES
NO FRAMES |
|
SUMMARY: INNER | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD |