org.apache.xerces.impl.xs
Class XMLSchemaLoader

java.lang.Object
  |
  +--org.apache.xerces.impl.xs.XMLSchemaLoader
All Implemented Interfaces:
org.apache.xerces.xni.grammars.XMLGrammarLoader

public class XMLSchemaLoader
extends java.lang.Object
implements org.apache.xerces.xni.grammars.XMLGrammarLoader

This class implements XMLGrammarLoader. It is designed to interact either with a proxy for a user application which wants to preparse schemas, or with our own Schema validator. It is hoped that none of these "external" classes will therefore need to communicate directly with XSDHandler in future.

This class only knows how to make XSDHandler do its thing. The caller must ensure that all its properties (schemaLocation, JAXPSchemaSource etc.) have been properly set.

Version:
$Id: XMLSchemaLoader.java,v 1.4 2002/06/13 22:59:59 neilg Exp $
Author:
Neil Graham, IBM

Field Summary
protected static java.lang.String CONTINUE_AFTER_FATAL_ERROR
          Feature identifier: continue after fatal error.
static java.lang.String EMPTY_STRING
           
static java.lang.String ENTITY_RESOLVER
          Property identifier: entity resolver.
protected static java.lang.String ERROR_HANDLER
          Property identifier: error handler.
static java.lang.String ERROR_REPORTER
          Property identifier: error reporter.
protected static java.lang.String JAXP_SCHEMA_SOURCE
          Property identifier: JAXP schema source.
protected static java.lang.String[] RECOGNIZED_FEATURES
           
protected static java.lang.String[] RECOGNIZED_PROPERTIES
           
protected static java.lang.String SCHEMA_FULL_CHECKING
          Feature identifier: schema full checking
protected static java.lang.String SCHEMA_LOCATION
          Property identifier: schema location.
protected static java.lang.String SCHEMA_NONS_LOCATION
          Property identifier: no namespace schema location.
static java.lang.String SYMBOL_TABLE
          Property identifier: symbol table.
static java.lang.String XMLGRAMMAR_POOL
          Property identifier: grammar pool.
 
Constructor Summary
XMLSchemaLoader()
           
XMLSchemaLoader(SymbolTable symbolTable)
           
 
Method Summary
 org.apache.xerces.xni.parser.XMLEntityResolver getEntityResolver()
          Returns the registered entity resolver.
 org.apache.xerces.xni.parser.XMLErrorHandler getErrorHandler()
          Returns the registered error handler.
 boolean getFeature(java.lang.String featureId)
          Returns the state of a feature.
 java.util.Locale getLocale()
          Return the Locale the XMLGrammarLoader is using.
 java.lang.Object getProperty(java.lang.String propertyId)
          Returns the state of a property.
 java.lang.String[] getRecognizedFeatures()
          Returns a list of feature identifiers that are recognized by this XMLGrammarLoader.
 java.lang.String[] getRecognizedProperties()
          Returns a list of property identifiers that are recognized by this XMLGrammarLoader.
 org.apache.xerces.xni.grammars.Grammar loadGrammar(org.apache.xerces.xni.parser.XMLInputSource source)
          Returns a Grammar object by parsing the contents of the entity pointed to by source.
 void reset()
           
static org.apache.xerces.xni.parser.XMLInputSource resolveDocument(XSDDescription desc, java.util.Hashtable locationPairs, org.apache.xerces.xni.parser.XMLEntityResolver entityResolver)
           
 void setEntityResolver(org.apache.xerces.xni.parser.XMLEntityResolver entityResolver)
          Sets the entity resolver.
 void setErrorHandler(org.apache.xerces.xni.parser.XMLErrorHandler errorHandler)
          Sets the error handler.
 void setFeature(java.lang.String featureId, boolean state)
          Sets the state of a feature.
 void setLocale(java.util.Locale locale)
          Set the locale to use for messages.
 void setProperty(java.lang.String propertyId, java.lang.Object state)
          Sets the state of a property.
static boolean tokenizeSchemaLocationStr(java.lang.String schemaStr, java.util.Hashtable locations)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_STRING

public static final java.lang.String EMPTY_STRING
See Also:
Constant Field Values

SCHEMA_FULL_CHECKING

protected static final java.lang.String SCHEMA_FULL_CHECKING
Feature identifier: schema full checking

See Also:
Constant Field Values

CONTINUE_AFTER_FATAL_ERROR

protected static final java.lang.String CONTINUE_AFTER_FATAL_ERROR
Feature identifier: continue after fatal error.

See Also:
Constant Field Values

RECOGNIZED_FEATURES

protected static final java.lang.String[] RECOGNIZED_FEATURES

SYMBOL_TABLE

public static final java.lang.String SYMBOL_TABLE
Property identifier: symbol table.

See Also:
Constant Field Values

ERROR_REPORTER

public static final java.lang.String ERROR_REPORTER
Property identifier: error reporter.

See Also:
Constant Field Values

ERROR_HANDLER

protected static final java.lang.String ERROR_HANDLER
Property identifier: error handler.

See Also:
Constant Field Values

ENTITY_RESOLVER

public static final java.lang.String ENTITY_RESOLVER
Property identifier: entity resolver.

See Also:
Constant Field Values

XMLGRAMMAR_POOL

public static final java.lang.String XMLGRAMMAR_POOL
Property identifier: grammar pool.

See Also:
Constant Field Values

SCHEMA_LOCATION

protected static final java.lang.String SCHEMA_LOCATION
Property identifier: schema location.

See Also:
Constant Field Values

SCHEMA_NONS_LOCATION

protected static final java.lang.String SCHEMA_NONS_LOCATION
Property identifier: no namespace schema location.

See Also:
Constant Field Values

JAXP_SCHEMA_SOURCE

protected static final java.lang.String JAXP_SCHEMA_SOURCE
Property identifier: JAXP schema source.

See Also:
Constant Field Values

RECOGNIZED_PROPERTIES

protected static final java.lang.String[] RECOGNIZED_PROPERTIES
Constructor Detail

XMLSchemaLoader

public XMLSchemaLoader()

XMLSchemaLoader

public XMLSchemaLoader(SymbolTable symbolTable)
Method Detail

getRecognizedFeatures

public java.lang.String[] getRecognizedFeatures()
Returns a list of feature identifiers that are recognized by this XMLGrammarLoader. This method may return null if no features are recognized.

Specified by:
getRecognizedFeatures in interface org.apache.xerces.xni.grammars.XMLGrammarLoader

getFeature

public boolean getFeature(java.lang.String featureId)
                   throws org.apache.xerces.xni.parser.XMLConfigurationException
Returns the state of a feature.

Specified by:
getFeature in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
Parameters:
featureId - The feature identifier.
Throws:
org.apache.xerces.xni.parser.XMLConfigurationException - Thrown on configuration error.

setFeature

public void setFeature(java.lang.String featureId,
                       boolean state)
                throws org.apache.xerces.xni.parser.XMLConfigurationException
Sets the state of a feature.

Specified by:
setFeature in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
Parameters:
featureId - The feature identifier.
state - The state of the feature.
Throws:
org.apache.xerces.xni.parser.XMLConfigurationException - Thrown when a feature is not recognized or cannot be set.

getRecognizedProperties

public java.lang.String[] getRecognizedProperties()
Returns a list of property identifiers that are recognized by this XMLGrammarLoader. This method may return null if no properties are recognized.

Specified by:
getRecognizedProperties in interface org.apache.xerces.xni.grammars.XMLGrammarLoader

getProperty

public java.lang.Object getProperty(java.lang.String propertyId)
                             throws org.apache.xerces.xni.parser.XMLConfigurationException
Returns the state of a property.

Specified by:
getProperty in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
Parameters:
propertyId - The property identifier.
Throws:
org.apache.xerces.xni.parser.XMLConfigurationException - Thrown on configuration error.

setProperty

public void setProperty(java.lang.String propertyId,
                        java.lang.Object state)
                 throws org.apache.xerces.xni.parser.XMLConfigurationException,
                        java.lang.ClassCastException
Sets the state of a property.

Specified by:
setProperty in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
Parameters:
propertyId - The property identifier.
state - The state of the property.
Throws:
org.apache.xerces.xni.parser.XMLConfigurationException - Thrown when a property is not recognized or cannot be set.
java.lang.ClassCastException

setLocale

public void setLocale(java.util.Locale locale)
Set the locale to use for messages.

Specified by:
setLocale in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
Parameters:
locale - The locale object to use for localization of messages.
Throws:
org.apache.xerces.xni.XNIException - Thrown if the parser does not support the specified locale.

getLocale

public java.util.Locale getLocale()
Return the Locale the XMLGrammarLoader is using.

Specified by:
getLocale in interface org.apache.xerces.xni.grammars.XMLGrammarLoader

setErrorHandler

public void setErrorHandler(org.apache.xerces.xni.parser.XMLErrorHandler errorHandler)
Sets the error handler.

Specified by:
setErrorHandler in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
Parameters:
errorHandler - The error handler.

getErrorHandler

public org.apache.xerces.xni.parser.XMLErrorHandler getErrorHandler()
Returns the registered error handler.

Specified by:
getErrorHandler in interface org.apache.xerces.xni.grammars.XMLGrammarLoader

setEntityResolver

public void setEntityResolver(org.apache.xerces.xni.parser.XMLEntityResolver entityResolver)
Sets the entity resolver.

Specified by:
setEntityResolver in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
Parameters:
entityResolver - The new entity resolver.

getEntityResolver

public org.apache.xerces.xni.parser.XMLEntityResolver getEntityResolver()
Returns the registered entity resolver.

Specified by:
getEntityResolver in interface org.apache.xerces.xni.grammars.XMLGrammarLoader

reset

public void reset()

loadGrammar

public org.apache.xerces.xni.grammars.Grammar loadGrammar(org.apache.xerces.xni.parser.XMLInputSource source)
                                                   throws java.io.IOException,
                                                          org.apache.xerces.xni.XNIException
Returns a Grammar object by parsing the contents of the entity pointed to by source.

Specified by:
loadGrammar in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
Parameters:
source - the location of the entity which forms the starting point of the grammar to be constructed.
Throws:
java.io.IOException - When a problem is encountered reading the entity XNIException When a condition arises (such as a FatalError) that requires parsing of the entity be terminated.
org.apache.xerces.xni.XNIException

resolveDocument

public static org.apache.xerces.xni.parser.XMLInputSource resolveDocument(XSDDescription desc,
                                                                          java.util.Hashtable locationPairs,
                                                                          org.apache.xerces.xni.parser.XMLEntityResolver entityResolver)
                                                                   throws java.io.IOException
java.io.IOException

tokenizeSchemaLocationStr

public static boolean tokenizeSchemaLocationStr(java.lang.String schemaStr,
                                                java.util.Hashtable locations)


Copyright © 1999-2002 Apache XML Project. All Rights Reserved.