|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectSchemaLocationResolver
public class SchemaLocationResolver
Resolves a physical schema location from a namespace uri.
This class works from a XSD instance from which it
resolves location on disk relative to.
Example usage:
XSD xsd = ...
String namespaceURI = xsd.getNamesapceURI();
SchemaLocationResolver resolver = new SchemaLocationResolver( xsd );
String schemaLocation = locator.resolveSchemaLocation( null, namespaceURI, "mySchema.xsd" );
| Field Summary | |
|---|---|
protected String[] |
lookupDirectories
A list of locations to use as prefixes when looking up schema files. |
protected XSD |
xsd
the xsd instance |
| Constructor Summary | |
|---|---|
SchemaLocationResolver(XSD xsd)
Creates the new schema location resolver. |
|
SchemaLocationResolver(XSD xsd,
String... lookupDirectories)
Creates the new schema location resolver specifying additional directories to locate schema files in. |
|
| Method Summary | |
|---|---|
boolean |
canHandle(XSDSchema schema,
String uri,
String location)
Determines if the locator can resolve the schema location for a particular namespace uri and schema location. |
String |
resolveSchemaLocation(XSDSchema schema,
String uri,
String location)
Resolves location to a physical location. |
String |
toString()
|
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected XSD xsd
protected String[] lookupDirectories
This value should be set in cases where an xml schema imports or includes schema files from sub directories.
| Constructor Detail |
|---|
public SchemaLocationResolver(XSD xsd)
xsd - The xsd to resolve filenames relative to.
public SchemaLocationResolver(XSD xsd,
String... lookupDirectories)
The lookupDirectories parameter should be used in cases where a main schema imports or includes files from sub directories. Consider the following schema file structure:
main.xsd
dir1/
include1.xsd
dir2/
include2.xsd
The constructor would be called with:
new SchemaLocationResolver(this,"include1","include2");
xsd - The xsd to resolve files relative to.lookupDirectories - Additional lookup directories relative to the xsd to lookup files in.| Method Detail |
|---|
public boolean canHandle(XSDSchema schema,
String uri,
String location)
public String resolveSchemaLocation(XSDSchema schema,
String uri,
String location)
Resolution is performed by stripping the filename off of location and looking up a resource located in the same package as the xsd.
resolveSchemaLocation in interface XSDSchemaLocationResolverpublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||