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

public final Class XSLoaderImpl

extends Object
implements XSLoader, DOMConfiguration
Class Inheritance
All Implemented Interfaces
org.w3c.dom.DOMConfiguration, com.sun.org.apache.xerces.internal.xs.XSLoader
Imports
com.sun.org.apache.xerces.internal.impl.xs.util.XSGrammarPool, com.sun.org.apache.xerces.internal.xni.grammars.Grammar, .XMLGrammarDescription, .XSGrammar, com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource, com.sun.org.apache.xerces.internal.xs.LSInputList, .StringList, .XSConstants, .XSLoader, .XSModel, .XSNamedMap, .XSObjectList, .XSTypeDefinition, org.w3c.dom.DOMConfiguration, .DOMException, .DOMStringList, org.w3c.dom.ls.LSInput

An implementation of XSLoader which wraps XMLSchemaLoader.

Author
Michael Glavassevich, IBM

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
XSLoaderImpl.XSGrammarMerger

Grammar pool which merges grammars from the same namespace into one.

Field Summary

Modifier and TypeField and Description
private final XSGrammarPool
fGrammarPool

Grammar pool.

private final XMLSchemaLoader
fSchemaLoader

Schema loader.

Constructor Summary

AccessConstructor and Description
public
XSLoaderImpl()

No-args constructor.

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.

public DOMConfiguration
getConfig()

Implements com.sun.org.apache.xerces.internal.xs.XSLoader.getConfig.

The configuration of a document.

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 XSModel

Returns:

An XSModel representing this schema.
load
(LSInput
The LSInput from which the source document is to be read.
is
)

Implements com.sun.org.apache.xerces.internal.xs.XSLoader.load.

Parse an XML Schema document from a resource identified by a LSInput .

public XSModel

Returns:

An XSModel representing the schema documents.
loadInputList
(LSInputList
The list of LSInputs from which the XML Schema documents are to be read.
is
)

Implements com.sun.org.apache.xerces.internal.xs.XSLoader.loadInputList.

Parses the content of XML Schema documents specified as a list of LSInputs.

public XSModel

Returns:

An XSModel representing this schema.
loadURI
(String
The location of the XML Schema document to be read.
uri
)

Implements com.sun.org.apache.xerces.internal.xs.XSLoader.loadURI.

Parse an XML Schema document from a location identified by a URI reference.

public XSModel

Returns:

An XSModel representing the schema documents.
loadURIList
(StringList
The list of URI locations.
uriList
)

Implements com.sun.org.apache.xerces.internal.xs.XSLoader.loadURIList.

Parses the content of XML Schema documents specified as the list of URI references.

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.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

fGrammarPoolback to summary
private final XSGrammarPool fGrammarPool

Grammar pool. Need this to prevent us from getting two grammars from the same namespace.

fSchemaLoaderback to summary
private final XMLSchemaLoader fSchemaLoader

Schema loader.

Constructor Detail

XSLoaderImplback to summary
public XSLoaderImpl()

No-args constructor.

Method Detail

canSetParameterback to summary
public boolean canSetParameter(String name, Object value)

Implements org.w3c.dom.DOMConfiguration.canSetParameter.

Doc from org.w3c.dom.DOMConfiguration.canSetParameter.

Check if setting a parameter to a specific value is supported.

Parameters
name:String

The name of the parameter to check.

value:Object

An object. if null, the returned value is true.

Returns:boolean

true if the parameter could be successfully set to the specified value, or false if the parameter is not recognized or the requested value is not supported. This does not change the current value of the parameter itself.

getConfigback to summary
public DOMConfiguration getConfig()

Implements com.sun.org.apache.xerces.internal.xs.XSLoader.getConfig.

The configuration of a document. It maintains a table of recognized parameters. Using the configuration, it is possible to change the behavior of the load methods. The configuration may support the setting of and the retrieval of the following non-boolean parameters defined on the DOMConfiguration interface: error-handler (DOMErrorHandler) and resource-resolver (LSResourceResolver).
The following list of boolean parameters is defined:

"validate"
true
[required] (default) Validate an XML Schema during loading. If validation errors are found, the error handler is notified.
false
[optional] Do not report errors during the loading of an XML Schema document.
getParameterback to summary
public Object getParameter(String name) throws DOMException

Implements org.w3c.dom.DOMConfiguration.getParameter.

Doc from org.w3c.dom.DOMConfiguration.getParameter.

Return the value of a parameter if known.

Parameters
name:String

The name of the parameter.

Returns:Object

The current object associated with the specified parameter or null if no object has been associated or if the parameter is not supported.

Exceptions
DOMException:
NOT_FOUND_ERR: Raised when the parameter name is not recognized.
getParameterNamesback to summary
public DOMStringList getParameterNames()

Implements org.w3c.dom.DOMConfiguration.getParameterNames.

Doc from 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. Note that this list can also contain parameter names defined outside this specification.

loadback to summary
public XSModel load(LSInput is)

Implements com.sun.org.apache.xerces.internal.xs.XSLoader.load.

Parse an XML Schema document from a resource identified by a LSInput .

Parameters
is:LSInput

The LSInput from which the source document is to be read.

Returns:XSModel

An XSModel representing this schema.

loadInputListback to summary
public XSModel loadInputList(LSInputList is)

Implements com.sun.org.apache.xerces.internal.xs.XSLoader.loadInputList.

Parses the content of XML Schema documents specified as a list of LSInputs.

Parameters
is:LSInputList

The list of LSInputs from which the XML Schema documents are to be read.

Returns:XSModel

An XSModel representing the schema documents.

loadURIback to summary
public XSModel loadURI(String uri)

Implements com.sun.org.apache.xerces.internal.xs.XSLoader.loadURI.

Parse an XML Schema document from a location identified by a URI reference. If the URI contains a fragment identifier, the behavior is not defined by this specification.

Parameters
uri:String

The location of the XML Schema document to be read.

Returns:XSModel

An XSModel representing this schema.

loadURIListback to summary
public XSModel loadURIList(StringList uriList)

Implements com.sun.org.apache.xerces.internal.xs.XSLoader.loadURIList.

Parses the content of XML Schema documents specified as the list of URI references. If the URI contains a fragment identifier, the behavior is not defined by this specification.

Parameters
uriList:StringList

The list of URI locations.

Returns:XSModel

An XSModel representing the schema documents.

setParameterback to summary
public void setParameter(String name, Object value) throws DOMException

Implements org.w3c.dom.DOMConfiguration.setParameter.

Doc from org.w3c.dom.DOMConfiguration.setParameter.

Set the value of a parameter.

Parameters
name:String

The name of the parameter to set.

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

Exceptions
DOMException:
NOT_FOUND_ERR: Raised when the parameter name is not recognized.
NOT_SUPPORTED_ERR: Raised when the parameter name is recognized but the requested value cannot be set.
TYPE_MISMATCH_ERR: Raised if the value type for this parameter name is incompatible with the expected value type.
com.sun.org.apache.xerces.internal.impl.xs back to summary

private final Class XSLoaderImpl.XSGrammarMerger

extends XSGrammarPool
Class Inheritance

Grammar pool which merges grammars from the same namespace into one. This eliminates duplicate named components. It doesn't ensure that the grammar is consistent, however this no worse than than the behaviour of XMLSchemaLoader alone when used as an XSLoader.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
containsGrammar(XMLGrammarDescription
The Grammar Description.
desc
)

Overrides com.sun.org.apache.xerces.internal.util.XMLGrammarPoolImpl.containsGrammar.

Returns true if the grammar pool contains a grammar associated to the specified grammar description.

public Grammar
getGrammar(XMLGrammarDescription
The Grammar Description.
desc
)

Overrides com.sun.org.apache.xerces.internal.util.XMLGrammarPoolImpl.getGrammar.

Returns the grammar associated to the specified grammar description.

private void
mergeSchemaGrammars(SchemaGrammar cachedGrammar, SchemaGrammar newGrammar)

public void
putGrammar(Grammar
The Grammar.
grammar
)

Overrides com.sun.org.apache.xerces.internal.util.XMLGrammarPoolImpl.putGrammar.

Puts the specified grammar into the grammar pool and associates it to its root element name or its target namespace.

public Grammar
retrieveGrammar(XMLGrammarDescription
The description of the Grammar being requested.
desc
)

Overrides com.sun.org.apache.xerces.internal.util.XMLGrammarPoolImpl.retrieveGrammar.

Implements com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarPool.retrieveGrammar.

This method requests that the application retrieve a grammar corresponding to the given GrammarIdentifier from its cache.

public Grammar[]
retrieveInitialGrammarSet(String
the type of the grammar, from the com.sun.org.apache.xerces.internal.xni.grammars.Grammar interface.
grammarType
)

Overrides com.sun.org.apache.xerces.internal.util.XMLGrammarPoolImpl.retrieveInitialGrammarSet.

Implements com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarPool.retrieveInitialGrammarSet.

retrieve the initial known set of grammars.

private SchemaGrammar
Inherited from com.sun.org.apache.xerces.internal.impl.xs.util.XSGrammarPool:
toXSModeltoXSModeltoXSModel

Constructor Detail

XSGrammarMergerback to summary
public XSGrammarMerger()

Method Detail

containsGrammarback to summary
public boolean containsGrammar(XMLGrammarDescription desc)

Overrides com.sun.org.apache.xerces.internal.util.XMLGrammarPoolImpl.containsGrammar.

Doc from com.sun.org.apache.xerces.internal.util.XMLGrammarPoolImpl.containsGrammar.

Returns true if the grammar pool contains a grammar associated to the specified grammar description. Currently, the root element name is used as the key for DTD grammars and the target namespace is used as the key for Schema grammars.

Parameters
desc:XMLGrammarDescription

The Grammar Description.

getGrammarback to summary
public Grammar getGrammar(XMLGrammarDescription desc)

Overrides com.sun.org.apache.xerces.internal.util.XMLGrammarPoolImpl.getGrammar.

Doc from com.sun.org.apache.xerces.internal.util.XMLGrammarPoolImpl.getGrammar.

Returns the grammar associated to the specified grammar description. Currently, the root element name is used as the key for DTD grammars and the target namespace is used as the key for Schema grammars.

Parameters
desc:XMLGrammarDescription

The Grammar Description.

mergeSchemaGrammarsback to summary
private void mergeSchemaGrammars(SchemaGrammar cachedGrammar, SchemaGrammar newGrammar)
putGrammarback to summary
public void putGrammar(Grammar grammar)

Overrides com.sun.org.apache.xerces.internal.util.XMLGrammarPoolImpl.putGrammar.

Doc from com.sun.org.apache.xerces.internal.util.XMLGrammarPoolImpl.putGrammar.

Puts the specified grammar into the grammar pool and associates it to its root element name or its target namespace.

Parameters
grammar:Grammar

The Grammar.

retrieveGrammarback to summary
public Grammar retrieveGrammar(XMLGrammarDescription desc)

Overrides com.sun.org.apache.xerces.internal.util.XMLGrammarPoolImpl.retrieveGrammar.

Implements com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarPool.retrieveGrammar.

Doc from com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarPool.retrieveGrammar.

This method requests that the application retrieve a grammar corresponding to the given GrammarIdentifier from its cache. If it cannot do so it must return null; the parser will then call the EntityResolver. An application must not call its EntityResolver itself from this method; this may result in infinite recursions.

Parameters
desc:XMLGrammarDescription

The description of the Grammar being requested.

Returns:Grammar

the Grammar corresponding to this description or null if no such Grammar is known.

retrieveInitialGrammarSetback to summary
public Grammar[] retrieveInitialGrammarSet(String grammarType)

Overrides com.sun.org.apache.xerces.internal.util.XMLGrammarPoolImpl.retrieveInitialGrammarSet.

Implements com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarPool.retrieveInitialGrammarSet.

Doc from com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarPool.retrieveInitialGrammarSet.

retrieve the initial known set of grammars. this method is called by a validator before the validation starts. the application can provide an initial set of grammars available to the current validation attempt.

Parameters
grammarType:String

the type of the grammar, from the com.sun.org.apache.xerces.internal.xni.grammars.Grammar interface.

Returns:Grammar[]

the set of grammars the validator may put in its "bucket"

toSchemaGrammarback to summary
private SchemaGrammar toSchemaGrammar(Grammar grammar)