org.apache.xerces.impl.xs

Class XMLSchemaLoader

public class XMLSchemaLoader extends Object implements XMLGrammarLoader, XMLComponent, XSLoader, DOMConfiguration

This class implements xni.grammars.XMLGrammarLoader. It also serves as implementation of xs.XSLoader interface and DOMConfiguration interface. This class 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.42 2005/07/25 04:54:15 mrglavas Exp $

Author: Neil Graham, IBM

UNKNOWN:

Field Summary
protected static StringALLOW_JAVA_ENCODINGS
Feature identifier: allow java encodings to be recognized when parsing schema docs.
protected static StringAUGMENT_PSVI
protected static StringCONTINUE_AFTER_FATAL_ERROR
Feature identifier: continue after fatal error.
protected static StringDISALLOW_DOCTYPE
Feature: disallow doctype
protected static StringENTITY_MANAGER
static StringENTITY_RESOLVER
Property identifier: entity resolver.
protected static StringERROR_HANDLER
Property identifier: error handler.
static StringERROR_REPORTER
Property identifier: error reporter.
protected static StringGENERATE_SYNTHETIC_ANNOTATIONS
Feature: generate synthetic annotations
protected static StringHONOUR_ALL_SCHEMALOCATIONS
Feature identifier: honour all schemaLocations
protected static StringJAXP_SCHEMA_SOURCE
Property identifier: JAXP schema source.
protected static StringPARSER_SETTINGS
protected static StringSCHEMA_FULL_CHECKING
Feature identifier: schema full checking
protected static StringSCHEMA_LOCATION
Property identifier: schema location.
protected static StringSCHEMA_NONS_LOCATION
Property identifier: no namespace schema location.
protected static StringSECURITY_MANAGER
protected static StringSTANDARD_URI_CONFORMANT_FEATURE
Feature identifier: standard uri conformant feature.
static StringSYMBOL_TABLE
Property identifier: symbol table.
protected static StringVALIDATE_ANNOTATIONS
Feature identifier: validate annotations.
static StringXMLGRAMMAR_POOL
Property identifier: grammar pool.
Constructor Summary
XMLSchemaLoader()
XMLSchemaLoader(SymbolTable symbolTable)
Method Summary
booleancanSetParameter(String name, Object value)
DOMConfigurationgetConfig()
XMLEntityResolvergetEntityResolver()
Returns the registered entity resolver.
XMLErrorHandlergetErrorHandler()
Returns the registered error handler.
booleangetFeature(String featureId)
Returns the state of a feature.
BooleangetFeatureDefault(String featureId)
LocalegetLocale()
Return the Locale the XMLGrammarLoader is using.
ObjectgetParameter(String name)
DOMStringListgetParameterNames()
ObjectgetProperty(String propertyId)
Returns the state of a property.
ObjectgetPropertyDefault(String propertyId)
String[]getRecognizedFeatures()
Returns a list of feature identifiers that are recognized by this XMLGrammarLoader.
String[]getRecognizedProperties()
Returns a list of property identifiers that are recognized by this XMLGrammarLoader.
XSModelload(LSInput is)
voidloadGrammar(XMLInputSource[] source)
Returns a Grammar object by parsing the contents of the entities pointed to by sources.
GrammarloadGrammar(XMLInputSource source)
Returns a Grammar object by parsing the contents of the entity pointed to by source.
XSModelloadInputList(LSInputList is)
XSModelloadURI(String uri)
XSModelloadURIList(StringList uriList)
static voidprocessExternalHints(String sl, String nsl, Hashtable locations, XMLErrorReporter er)
voidreset(XMLComponentManager componentManager)
static XMLInputSourceresolveDocument(XSDDescription desc, Hashtable locationPairs, XMLEntityResolver entityResolver)
This method tries to resolve location of the given schema.
voidsetEntityResolver(XMLEntityResolver entityResolver)
Sets the entity resolver.
voidsetErrorHandler(XMLErrorHandler errorHandler)
Sets the error handler.
voidsetFeature(String featureId, boolean state)
Sets the state of a feature.
voidsetLocale(Locale locale)
Set the locale to use for messages.
voidsetParameter(String name, Object value)
voidsetProperty(String propertyId, Object state)
Sets the state of a property.
static booleantokenizeSchemaLocationStr(String schemaStr, Hashtable locations)

Field Detail

ALLOW_JAVA_ENCODINGS

protected static final String ALLOW_JAVA_ENCODINGS
Feature identifier: allow java encodings to be recognized when parsing schema docs.

AUGMENT_PSVI

protected static final String AUGMENT_PSVI

CONTINUE_AFTER_FATAL_ERROR

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

DISALLOW_DOCTYPE

protected static final String DISALLOW_DOCTYPE
Feature: disallow doctype

ENTITY_MANAGER

protected static final String ENTITY_MANAGER

ENTITY_RESOLVER

public static final String ENTITY_RESOLVER
Property identifier: entity resolver.

ERROR_HANDLER

protected static final String ERROR_HANDLER
Property identifier: error handler.

ERROR_REPORTER

public static final String ERROR_REPORTER
Property identifier: error reporter.

GENERATE_SYNTHETIC_ANNOTATIONS

protected static final String GENERATE_SYNTHETIC_ANNOTATIONS
Feature: generate synthetic annotations

HONOUR_ALL_SCHEMALOCATIONS

protected static final String HONOUR_ALL_SCHEMALOCATIONS
Feature identifier: honour all schemaLocations

JAXP_SCHEMA_SOURCE

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

PARSER_SETTINGS

protected static final String PARSER_SETTINGS

SCHEMA_FULL_CHECKING

protected static final String SCHEMA_FULL_CHECKING
Feature identifier: schema full checking

SCHEMA_LOCATION

protected static final String SCHEMA_LOCATION
Property identifier: schema location.

SCHEMA_NONS_LOCATION

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

SECURITY_MANAGER

protected static final String SECURITY_MANAGER

STANDARD_URI_CONFORMANT_FEATURE

protected static final String STANDARD_URI_CONFORMANT_FEATURE
Feature identifier: standard uri conformant feature.

SYMBOL_TABLE

public static final String SYMBOL_TABLE
Property identifier: symbol table.

VALIDATE_ANNOTATIONS

protected static final String VALIDATE_ANNOTATIONS
Feature identifier: validate annotations.

XMLGRAMMAR_POOL

public static final String XMLGRAMMAR_POOL
Property identifier: grammar pool.

Constructor Detail

XMLSchemaLoader

public XMLSchemaLoader()

XMLSchemaLoader

public XMLSchemaLoader(SymbolTable symbolTable)

Method Detail

canSetParameter

public boolean canSetParameter(String name, Object value)

getConfig

public DOMConfiguration getConfig()

getEntityResolver

public XMLEntityResolver getEntityResolver()
Returns the registered entity resolver.

getErrorHandler

public XMLErrorHandler getErrorHandler()
Returns the registered error handler.

getFeature

public boolean getFeature(String featureId)
Returns the state of a feature.

Parameters: featureId The feature identifier.

Throws: XMLConfigurationException Thrown on configuration error.

getFeatureDefault

public Boolean getFeatureDefault(String featureId)

getLocale

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

getParameter

public Object getParameter(String name)

getParameterNames

public DOMStringList getParameterNames()

getProperty

public Object getProperty(String propertyId)
Returns the state of a property.

Parameters: propertyId The property identifier.

Throws: XMLConfigurationException Thrown on configuration error.

getPropertyDefault

public Object getPropertyDefault(String propertyId)

getRecognizedFeatures

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

getRecognizedProperties

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

load

public XSModel load(LSInput is)

loadGrammar

public void loadGrammar(XMLInputSource[] source)
Returns a Grammar object by parsing the contents of the entities pointed to by sources.

Parameters: source[] the locations of the entity which forms the staring point of the grammars to be constructed

Throws: IOException when a problem is encounted reading the entity XNIException when a condition arises (such as a FatalError) that requires parsing of the entity be terminated

loadGrammar

public Grammar loadGrammar(XMLInputSource source)
Returns a Grammar object by parsing the contents of the entity pointed to by source.

Parameters: source the location of the entity which forms the starting point of the grammar to be constructed.

Throws: 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.

loadInputList

public XSModel loadInputList(LSInputList is)

loadURI

public XSModel loadURI(String uri)

loadURIList

public XSModel loadURIList(StringList uriList)

processExternalHints

public static void processExternalHints(String sl, String nsl, Hashtable locations, XMLErrorReporter er)

reset

public void reset(XMLComponentManager componentManager)

resolveDocument

public static XMLInputSource resolveDocument(XSDDescription desc, Hashtable locationPairs, XMLEntityResolver entityResolver)
This method tries to resolve location of the given schema. The loader stores the namespace/location pairs in a hashtable (use "" as the namespace of absent namespace). When resolving an entity, loader first tries to find in the hashtable whether there is a value for that namespace, if so, pass that location value to the user-defined entity resolver.

Parameters: desc locationPairs entityResolver

Returns:

Throws: IOException

setEntityResolver

public void setEntityResolver(XMLEntityResolver entityResolver)
Sets the entity resolver.

Parameters: entityResolver The new entity resolver.

setErrorHandler

public void setErrorHandler(XMLErrorHandler errorHandler)
Sets the error handler.

Parameters: errorHandler The error handler.

setFeature

public void setFeature(String featureId, boolean state)
Sets the state of a feature.

Parameters: featureId The feature identifier. state The state of the feature.

Throws: XMLConfigurationException Thrown when a feature is not recognized or cannot be set.

setLocale

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

Parameters: locale The locale object to use for localization of messages.

Throws: XNIException Thrown if the parser does not support the specified locale.

setParameter

public void setParameter(String name, Object value)

setProperty

public void setProperty(String propertyId, Object state)
Sets the state of a property.

Parameters: propertyId The property identifier. state The state of the property.

Throws: XMLConfigurationException Thrown when a property is not recognized or cannot be set.

tokenizeSchemaLocationStr

public static boolean tokenizeSchemaLocationStr(String schemaStr, Hashtable locations)
Copyright © 1999-2005 Apache XML Project. All Rights Reserved.