org.geotools.xml
Class SchemaLocator

java.lang.Object
  extended by org.geotools.xml.SchemaLocator
All Implemented Interfaces:
org.eclipse.xsd.util.XSDSchemaLocator

public final class SchemaLocator
extends java.lang.Object
implements org.eclipse.xsd.util.XSDSchemaLocator

Helper class which ensures that the xsd schema parser uses pre-build schema objects.

This class works from a XSD which contains a reference to the schema.

Example usage:

         XSD xsd = ...;
         String namespaceURI = xsd.getNamesapceURI();

         SchemaLocator locator = new SchemaLocator( xsd );
         XSDSchema schema = locator.locateSchema( null, namespaceURI, null, null);
         

Author:
Justin Deoliveira, The Open Planning Project

Field Summary
protected static java.util.logging.Logger LOGGER
          logging instance
protected  XSD xsd
          The xsd instance.
 
Constructor Summary
SchemaLocator(XSD xsd)
          Creates a new instance of the schema locator.
 
Method Summary
 boolean canHandle(org.eclipse.xsd.XSDSchema schema, java.lang.String namespaceURI, java.lang.String rawSchemaLocationURI, java.lang.String resolvedSchemaLocationURI)
          Determines if the locator can locate a schema for the specified namespace and location.
 org.eclipse.xsd.XSDSchema locateSchema(org.eclipse.xsd.XSDSchema schema, java.lang.String namespaceURI, java.lang.String rawSchemaLocationURI, java.lang.String resolvedSchemaLocationURI)
          Creates the schema, returning null if the schema could not be created.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOGGER

protected static java.util.logging.Logger LOGGER
logging instance


xsd

protected XSD xsd
The xsd instance.

Constructor Detail

SchemaLocator

public SchemaLocator(XSD xsd)
Creates a new instance of the schema locator.

Parameters:
xsd - The XSD instance that references the schema to be "located".
Method Detail

canHandle

public boolean canHandle(org.eclipse.xsd.XSDSchema schema,
                         java.lang.String namespaceURI,
                         java.lang.String rawSchemaLocationURI,
                         java.lang.String resolvedSchemaLocationURI)
Determines if the locator can locate a schema for the specified namespace and location.

Returns:
true if it can handle, otherwise false.

locateSchema

public org.eclipse.xsd.XSDSchema locateSchema(org.eclipse.xsd.XSDSchema schema,
                                              java.lang.String namespaceURI,
                                              java.lang.String rawSchemaLocationURI,
                                              java.lang.String resolvedSchemaLocationURI)
Creates the schema, returning null if the schema could not be created.

namespaceURI should not be null. All other parameters are ignored.

Specified by:
locateSchema in interface org.eclipse.xsd.util.XSDSchemaLocator
See Also:
XSDSchemaLocator.locateSchema(org.eclipse.xsd.XSDSchema, java.lang.String, java.lang.String, java.lang.String)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 1996-2010 Geotools. All Rights Reserved.