Top Description Inners Fields Constructors Methods
org.apache.xerces.impl.xs

public Class XMLSchemaLoader

extends Object
implements XMLGrammarLoader, XMLComponent, XSElementDeclHelper, XSLoader, DOMConfiguration
Class Inheritance
All Implemented Interfaces
org.w3c.dom.DOMConfiguration, org.apache.xerces.xs.XSLoader, org.apache.xerces.impl.xs.XSElementDeclHelper, org.apache.xerces.xni.parser.XMLComponent, org.apache.xerces.xni.grammars.XMLGrammarLoader
Imports
java.io.BufferedInputStream, .File, .FileInputStream, .FileNotFoundException, .IOException, .InputStream, .Reader, .StringReader, java.util.ArrayList, .Hashtable, .Locale, .StringTokenizer, .WeakHashMap, org.apache.xerces.dom.DOMErrorImpl, .DOMMessageFormatter, .DOMStringListImpl, org.apache.xerces.impl.Constants, .XMLEntityManager, .XMLErrorReporter, org.apache.xerces.impl.dv.InvalidDatatypeValueException, .SchemaDVFactory, org.apache.xerces.impl.dv.xs.SchemaDVFactoryImpl, org.apache.xerces.impl.xs.models.CMBuilder, .CMNodeFactory, org.apache.xerces.impl.xs.traversers.XSDHandler, org.apache.xerces.util.DOMEntityResolverWrapper, .DOMErrorHandlerWrapper, .DefaultErrorHandler, .MessageFormatter, .ParserConfigurationSettings, .SymbolTable, .XMLSymbols, .URI.MalformedURIException, org.apache.xerces.xni.QName, .XNIException, org.apache.xerces.xni.grammars.Grammar, .XMLGrammarDescription, .XMLGrammarLoader, .XMLGrammarPool, .XSGrammar, org.apache.xerces.xni.parser.XMLComponent, .XMLComponentManager, .XMLConfigurationException, .XMLEntityResolver, .XMLErrorHandler, .XMLInputSource, org.apache.xerces.xs.LSInputList, .StringList, .XSLoader, .XSModel, org.w3c.dom.DOMConfiguration, .DOMError, .DOMErrorHandler, .DOMException, .DOMStringList, org.w3c.dom.ls.LSInput, .LSResourceResolver, org.xml.sax.InputSource

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.

Author
Neil Graham, IBM
Version
$Id: XMLSchemaLoader.java 982466 2010-08-05 04:41:01Z mrglavas $

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
protected static final String
ALLOW_JAVA_ENCODINGS

Feature identifier: allow java encodings to be recognized when parsing schema docs.

protected static final String
protected static final String
CONTINUE_AFTER_FATAL_ERROR

Feature identifier: continue after fatal error.

protected static final String
DISALLOW_DOCTYPE

Feature: disallow doctype

protected static final String
public static final String
ENTITY_RESOLVER

Property identifier: entity resolver.

protected static final String
ERROR_HANDLER

Property identifier: error handler.

public static final String
ERROR_REPORTER

Property identifier: error reporter.

private CMBuilder
private XSDeclarationPool
private SchemaDVFactory
private XMLEntityManager
private DOMErrorHandlerWrapper
fErrorHandler

DOM L3 error handler

private XMLErrorReporter
private String
private String
private XSGrammarBucket
private XMLGrammarPool
private boolean
private WeakHashMap<K, V>
private boolean
private Object
private final ParserConfigurationSettings
private Locale
private DOMStringList
private DOMEntityResolverWrapper
fResourceResolver

DOM L3 resource resolver

private XSDHandler
private boolean
private SubstitutionGroupHandler
private XMLEntityResolver
private XSDDescription
protected static final String
GENERATE_SYNTHETIC_ANNOTATIONS

Feature: generate synthetic annotations

protected static final String
HONOUR_ALL_SCHEMALOCATIONS

Feature identifier: honour all schemaLocations

protected static final String
JAXP_SCHEMA_SOURCE

Property identifier: JAXP schema source.

protected static final String
LOCALE

Property identifier: locale.

protected static final String
NAMESPACE_GROWTH

Feature identifier: namespace growth

protected static final String
private static final String[]
private static final String[]
protected static final String
SCHEMA_DV_FACTORY

Property identifier: Schema DV Factory

protected static final String
SCHEMA_FULL_CHECKING

Feature identifier: schema full checking

protected static final String
SCHEMA_LOCATION

Property identifier: schema location.

protected static final String
SCHEMA_NONS_LOCATION

Property identifier: no namespace schema location.

protected static final String
protected static final String
STANDARD_URI_CONFORMANT_FEATURE

Feature identifier: standard uri conformant feature.

public static final String
SYMBOL_TABLE

Property identifier: symbol table.

protected static final String
TOLERATE_DUPLICATES

Feature identifier: tolerate duplicates

protected static final String
VALIDATE_ANNOTATIONS

Feature identifier: validate annotations.

public static final String
XMLGRAMMAR_POOL

Property identifier: grammar pool.

Constructor Summary

AccessConstructor and Description
public
public
pack-priv
XMLSchemaLoader(XMLErrorReporter errorReporter, XSGrammarBucket grammarBucket, SubstitutionGroupHandler sHandler, CMBuilder builder)

This constractor is used by the XMLSchemaValidator.

pack-priv
XMLSchemaLoader(SymbolTable symbolTable, XMLErrorReporter errorReporter, XMLEntityManager entityResolver, XSGrammarBucket grammarBucket, SubstitutionGroupHandler sHandler, CMBuilder builder)

Method Summary

Modifier and TypeMethod and Description
public boolean
canSetParameter(String
The name of the parameter to check.
name
,
Object
An object. if null, the returned value is true.
value
)

Implements org.w3c.dom.DOMConfiguration.canSetParameter.

Check if setting a parameter to a specific value is supported.
pack-priv XMLInputSource
public DOMConfiguration
getConfig()

Implements org.apache.xerces.xs.XSLoader.getConfig.

The configuration of a document.
public XMLEntityResolver
getEntityResolver()

Implements org.apache.xerces.xni.grammars.XMLGrammarLoader.getEntityResolver.

Returns the registered entity resolver.
public XMLErrorHandler
getErrorHandler()

Implements org.apache.xerces.xni.grammars.XMLGrammarLoader.getErrorHandler.

Returns the registered error handler.
public boolean
getFeature(String
The feature identifier.
featureId
)

Implements org.apache.xerces.xni.grammars.XMLGrammarLoader.getFeature.

Returns the state of a feature.
public Boolean
getFeatureDefault(String
The feature identifier.
featureId
)

Implements org.apache.xerces.xni.parser.XMLComponent.getFeatureDefault.

Returns the default state for a feature, or null if this component does not want to report a default value for this feature.
public XSElementDecl
public Locale
getLocale()

Implements org.apache.xerces.xni.grammars.XMLGrammarLoader.getLocale.

Return the Locale the XMLGrammarLoader is using.
public Object
getParameter(String
The name of the parameter.
name
)

Implements org.w3c.dom.DOMConfiguration.getParameter.

Return the value of a parameter if known.
public DOMStringList
getParameterNames()

Implements org.w3c.dom.DOMConfiguration.getParameterNames.

The list of the parameters supported by this DOMConfiguration object and for which at least one value can be set by the application.
public Object
getProperty(String
The property identifier.
propertyId
)

Implements org.apache.xerces.xni.grammars.XMLGrammarLoader.getProperty.

Returns the state of a property.
public Object
getPropertyDefault(String
The property identifier.
propertyId
)

Implements org.apache.xerces.xni.parser.XMLComponent.getPropertyDefault.

Returns the default state for a property, or null if this component does not want to report a default value for this property.
public String[]
public String[]
private void
public XSModel
load(LSInput
The LSInput from which the source document is to be read.
is
)

Implements org.apache.xerces.xs.XSLoader.load.

Parse an XML Schema document from a resource identified by a LSInput .
public void
loadGrammar(XMLInputSource[]
the locations of the entity which forms the staring point of the grammars to be constructed
source
)

Returns a Grammar object by parsing the contents of the entities pointed to by sources.

public Grammar
loadGrammar(XMLInputSource
the location of the entity which forms the starting point of the grammar to be constructed.
source
)

Implements org.apache.xerces.xni.grammars.XMLGrammarLoader.loadGrammar.

Returns a Grammar object by parsing the contents of the entity pointed to by source.
public XSModel
loadInputList(LSInputList
The list of LSInputs from which the XML Schema documents are to be read.
is
)

Implements org.apache.xerces.xs.XSLoader.loadInputList.

Parses the content of XML Schema documents specified as a list of LSInputs.
pack-priv SchemaGrammar

Returns:

An XML Schema grammar
loadSchema
(XSDDescription desc, XMLInputSource source, Hashtable<K, V> locationPairs)

This method is called either from XMLGrammarLoader.loadGrammar or from XMLSchemaValidator.

public XSModel
loadURI(String
The location of the XML Schema document to be read.
uri
)

Implements org.apache.xerces.xs.XSLoader.loadURI.

Parse an XML Schema document from a location identified by a URI reference.
public XSModel
loadURIList(StringList
The list of URI locations.
uriList
)

Implements org.apache.xerces.xs.XSLoader.loadURIList.

Parses the content of XML Schema documents specified as the list of URI references.
private boolean
public static void
private void
processJAXPSchemaSource(Hashtable<K, V> locationPairs)

Translate the various JAXP SchemaSource property types to XNI XMLInputSource.

pack-priv void
public void
reset(XMLComponentManager
The component manager.
componentManager
)

Implements org.apache.xerces.xni.parser.XMLComponent.reset.

Resets the component.
public static XMLInputSource

Returns:

the XMLInputSource
resolveDocument
(XSDDescription desc, Hashtable<K, V> locationPairs, XMLEntityResolver entityResolver)

This method tries to resolve location of the given schema.

private static XMLInputSource
public void
setEntityResolver(XMLEntityResolver
The new entity resolver.
entityResolver
)

Implements org.apache.xerces.xni.grammars.XMLGrammarLoader.setEntityResolver.

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

Implements org.apache.xerces.xni.grammars.XMLGrammarLoader.setErrorHandler.

Sets the error handler.
public void
setFeature(String
The feature identifier.
featureId
,
boolean
The state of the feature.
state
)

Implements org.apache.xerces.xni.grammars.XMLGrammarLoader.setFeature, org.apache.xerces.xni.parser.XMLComponent.setFeature.

Sets the state of a feature.
public void
setLocale(Locale
The locale object to use for localization of messages.
locale
)

Implements org.apache.xerces.xni.grammars.XMLGrammarLoader.setLocale.

Set the locale to use for messages.
public void
setParameter(String
The name of the parameter to set.
name
,
Object
The new value or null if the user wishes to unset the parameter. While the type of the value parameter is defined as DOMUserData, the object type must match the type defined by the definition of the parameter. For example, if the parameter is "error-handler", the value must be of type DOMErrorHandler.
value
)

Implements org.w3c.dom.DOMConfiguration.setParameter.

Set the value of a parameter.
public void
setProperty(String
The property identifier.
propertyId
,
Object
The state of the property.
state
)

Implements org.apache.xerces.xni.grammars.XMLGrammarLoader.setProperty, org.apache.xerces.xni.parser.XMLComponent.setProperty.

Sets the state of a property.
public static boolean
tokenizeSchemaLocationStr(String schemaStr, Hashtable<K, V> locations, String base)

private XMLInputSource
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait