public class XMLSchemaLoader
extends java.lang.Object
implements org.apache.xerces.xni.grammars.XMLGrammarLoader, org.apache.xerces.xni.parser.XMLComponent, org.apache.xerces.xs.XSLoader, org.w3c.dom.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.
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.
canSetParameter
public boolean canSetParameter(String name,
Object value)
- canSetParameter in interface org.w3c.dom.DOMConfiguration
getConfig
public org.w3c.dom.DOMConfiguration getConfig()
getEntityResolver
public org.apache.xerces.xni.parser.XMLEntityResolver getEntityResolver()
Returns the registered entity resolver.
- getEntityResolver in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
getErrorHandler
public org.apache.xerces.xni.parser.XMLErrorHandler getErrorHandler()
Returns the registered error handler.
- getErrorHandler in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
getFeature
public boolean getFeature(String featureId)
throws org.apache.xerces.xni.parser.XMLConfigurationException
Returns the state of a feature.
- getFeature in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
featureId
- The feature identifier.
org.apache.xerces.xni.parser.XMLConfigurationException
- Thrown on configuration error.
getFeatureDefault
public Boolean getFeatureDefault(String featureId)
- getFeatureDefault in interface org.apache.xerces.xni.parser.XMLComponent
getLocale
public Locale getLocale()
Return the Locale the XMLGrammarLoader is using.
- getLocale in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
getParameter
public Object getParameter(String name)
throws org.w3c.dom.DOMException
- getParameter in interface org.w3c.dom.DOMConfiguration
getParameterNames
public org.w3c.dom.DOMStringList getParameterNames()
- getParameterNames in interface org.w3c.dom.DOMConfiguration
getProperty
public Object getProperty(String propertyId)
throws org.apache.xerces.xni.parser.XMLConfigurationException
Returns the state of a property.
- getProperty in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
propertyId
- The property identifier.
org.apache.xerces.xni.parser.XMLConfigurationException
- Thrown on configuration error.
getPropertyDefault
public Object getPropertyDefault(String propertyId)
- getPropertyDefault in interface org.apache.xerces.xni.parser.XMLComponent
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.
- getRecognizedFeatures in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
- getRecognizedFeatures in interface org.apache.xerces.xni.parser.XMLComponent
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.
- getRecognizedProperties in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
- getRecognizedProperties in interface org.apache.xerces.xni.parser.XMLComponent
load
public org.apache.xerces.xs.XSModel load(org.w3c.dom.ls.LSInput is)
loadGrammar
public org.apache.xerces.xni.grammars.Grammar loadGrammar(org.apache.xerces.xni.parser.XMLInputSource source)
throws IOException,
org.apache.xerces.xni.XNIException
Returns a Grammar object by parsing the contents of the
entity pointed to by source.
- loadGrammar in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
source
- the location of the entity which forms
the starting point of the grammar to be constructed.
loadGrammar
public void loadGrammar(source[] )
throws IOException,
org.apache.xerces.xni.XNIException
Returns a Grammar object by parsing the contents of the
entities pointed to by sources.
org.apache.xerces.xni.XNIException
- when a condition arises (such as a FatalError) that requires parsing
of the entity be terminated
loadInputList
public org.apache.xerces.xs.XSModel loadInputList(org.apache.xerces.xs.LSInputList is)
loadURI
public org.apache.xerces.xs.XSModel loadURI(String uri)
loadURIList
public org.apache.xerces.xs.XSModel loadURIList(org.apache.xerces.xs.StringList uriList)
processExternalHints
public static void processExternalHints(String sl,
String nsl,
Hashtable locations,
XMLErrorReporter er)
reset
public void reset(org.apache.xerces.xni.parser.XMLComponentManager componentManager)
throws org.apache.xerces.xni.parser.XMLConfigurationException
- reset in interface org.apache.xerces.xni.parser.XMLComponent
resolveDocument
public static org.apache.xerces.xni.parser.XMLInputSource resolveDocument(XSDDescription desc,
Hashtable locationPairs,
org.apache.xerces.xni.parser.XMLEntityResolver entityResolver)
throws IOException
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.
desc
- locationPairs
- entityResolver
-
setEntityResolver
public void setEntityResolver(org.apache.xerces.xni.parser.XMLEntityResolver entityResolver)
Sets the entity resolver.
- setEntityResolver in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
entityResolver
- The new entity resolver.
setErrorHandler
public void setErrorHandler(org.apache.xerces.xni.parser.XMLErrorHandler errorHandler)
Sets the error handler.
- setErrorHandler in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
errorHandler
- The error handler.
setFeature
public void setFeature(String featureId,
boolean state)
throws org.apache.xerces.xni.parser.XMLConfigurationException
Sets the state of a feature.
- setFeature in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
- setFeature in interface org.apache.xerces.xni.parser.XMLComponent
featureId
- The feature identifier.state
- The state of the feature.
org.apache.xerces.xni.parser.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.
- setLocale in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
locale
- The locale object to use for localization of messages.
setParameter
public void setParameter(String name,
Object value)
throws org.w3c.dom.DOMException
- setParameter in interface org.w3c.dom.DOMConfiguration
setProperty
public void setProperty(String propertyId,
Object state)
throws org.apache.xerces.xni.parser.XMLConfigurationException
Sets the state of a property.
- setProperty in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
- setProperty in interface org.apache.xerces.xni.parser.XMLComponent
propertyId
- The property identifier.state
- The state of the property.
org.apache.xerces.xni.parser.XMLConfigurationException
- Thrown when a property is not
recognized or cannot be set.
tokenizeSchemaLocationStr
public static boolean tokenizeSchemaLocationStr(String schemaStr,
Hashtable locations)