org.apache.xerces.impl.dtd
Class XMLDTDLoader

java.lang.Object
  extended by org.apache.xerces.impl.dtd.XMLDTDProcessor
      extended by org.apache.xerces.impl.dtd.XMLDTDLoader
All Implemented Interfaces:
XMLGrammarLoader, XMLComponent, XMLDTDContentModelFilter, XMLDTDContentModelSource, XMLDTDFilter, XMLDTDSource, XMLDTDContentModelHandler, XMLDTDHandler
Direct Known Subclasses:
XML11DTDProcessor

public class XMLDTDLoader
extends XMLDTDProcessor
implements XMLGrammarLoader

The DTD loader. The loader knows how to build grammars from XMLInputSources. It extends the DTD processor in order to do this; it's a separate class because DTD processors don't need to know how to talk to the outside world in their role as instance-document helpers.

This component requires the following features and properties. It know ho to set them if no one else does:from the

Version:
$Id: XMLDTDLoader.java 446755 2006-09-15 21:56:27Z mrglavas $
Author:
Neil Graham, IBM, Michael Glavassevich, IBM

Field Summary
static java.lang.String ENTITY_RESOLVER
          Property identifier: entity resolver.
 
Fields inherited from interface org.apache.xerces.xni.XMLDTDHandler
CONDITIONAL_IGNORE, CONDITIONAL_INCLUDE
 
Fields inherited from interface org.apache.xerces.xni.XMLDTDContentModelHandler
OCCURS_ONE_OR_MORE, OCCURS_ZERO_OR_MORE, OCCURS_ZERO_OR_ONE, SEPARATOR_CHOICE, SEPARATOR_SEQUENCE
 
Constructor Summary
XMLDTDLoader()
          Deny default construction; we need a SymtolTable!
XMLDTDLoader(SymbolTable symbolTable)
           
XMLDTDLoader(SymbolTable symbolTable, XMLGrammarPool grammarPool)
           
 
Method Summary
 XMLEntityResolver getEntityResolver()
          Returns the registered entity resolver.
 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 component.
 java.lang.String[] getRecognizedProperties()
          Returns a list of property identifiers that are recognized by this component.
 Grammar loadGrammar(XMLInputSource source)
          Returns a Grammar object by parsing the contents of the entity pointed to by source.
 void loadGrammarWithContext(XMLDTDValidator validator, java.lang.String rootName, java.lang.String publicId, java.lang.String systemId, java.lang.String baseSystemId, java.lang.String internalSubset)
          Parse a DTD internal and/or external subset and insert the content into the existing DTD grammar owned by the given DTDValidator.
 void setEntityResolver(XMLEntityResolver entityResolver)
          Sets the entity resolver.
 void setErrorHandler(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 value)
          Sets the value of a property.
 
Methods inherited from class org.apache.xerces.impl.dtd.XMLDTDProcessor
any, attributeDecl, comment, element, elementDecl, empty, endAttlist, endConditional, endContentModel, endDTD, endExternalSubset, endGroup, endParameterEntity, externalEntityDecl, getDTDContentModelHandler, getDTDContentModelSource, getDTDHandler, getDTDSource, getFeatureDefault, getPropertyDefault, ignoredCharacters, internalEntityDecl, notationDecl, occurrence, pcdata, processingInstruction, reset, separator, setDTDContentModelHandler, setDTDContentModelSource, setDTDHandler, setDTDSource, startAttlist, startConditional, startContentModel, startDTD, startExternalSubset, startGroup, startParameterEntity, textDecl, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENTITY_RESOLVER

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

See Also:
Constant Field Values
Constructor Detail

XMLDTDLoader

public XMLDTDLoader()
Deny default construction; we need a SymtolTable!


XMLDTDLoader

public XMLDTDLoader(SymbolTable symbolTable)

XMLDTDLoader

public XMLDTDLoader(SymbolTable symbolTable,
                    XMLGrammarPool grammarPool)
Method Detail

getRecognizedFeatures

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

Specified by:
getRecognizedFeatures in interface XMLGrammarLoader
Specified by:
getRecognizedFeatures in interface XMLComponent
Overrides:
getRecognizedFeatures in class XMLDTDProcessor

setFeature

public void setFeature(java.lang.String featureId,
                       boolean state)
                throws XMLConfigurationException
Sets the state of a feature. This method is called by the component manager any time after reset when a feature changes state.

Note: Components should silently ignore features that do not affect the operation of the component.

Specified by:
setFeature in interface XMLGrammarLoader
Specified by:
setFeature in interface XMLComponent
Overrides:
setFeature in class XMLDTDProcessor
Parameters:
featureId - The feature identifier.
state - The state of the feature.
Throws:
SAXNotRecognizedException - The component should not throw this exception.
SAXNotSupportedException - The component should not throw this exception.
XMLConfigurationException - Thrown for configuration error. In general, components should only throw this exception if it is really a critical error.

getRecognizedProperties

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

Specified by:
getRecognizedProperties in interface XMLGrammarLoader
Specified by:
getRecognizedProperties in interface XMLComponent
Overrides:
getRecognizedProperties in class XMLDTDProcessor

getProperty

public java.lang.Object getProperty(java.lang.String propertyId)
                             throws XMLConfigurationException
Returns the state of a property.

Specified by:
getProperty in interface XMLGrammarLoader
Parameters:
propertyId - The property identifier.
Throws:
XMLConfigurationException - Thrown on configuration error.

setProperty

public void setProperty(java.lang.String propertyId,
                        java.lang.Object value)
                 throws XMLConfigurationException
Sets the value of a property. This method is called by the component manager any time after reset when a property changes value.

Note: Components should silently ignore properties that do not affect the operation of the component.

Specified by:
setProperty in interface XMLGrammarLoader
Specified by:
setProperty in interface XMLComponent
Overrides:
setProperty in class XMLDTDProcessor
Parameters:
propertyId - The property identifier.
value - The value of the property.
Throws:
SAXNotRecognizedException - The component should not throw this exception.
SAXNotSupportedException - The component should not throw this exception.
XMLConfigurationException - Thrown for configuration error. In general, components should only throw this exception if it is really a critical error.

getFeature

public boolean getFeature(java.lang.String featureId)
                   throws XMLConfigurationException
Returns the state of a feature.

Specified by:
getFeature in interface XMLGrammarLoader
Parameters:
featureId - The feature identifier.
Throws:
XMLConfigurationException - Thrown on configuration error.

setLocale

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

Specified by:
setLocale in interface XMLGrammarLoader
Parameters:
locale - The locale object to use for localization of messages.
Throws:
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 XMLGrammarLoader

setErrorHandler

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

Specified by:
setErrorHandler in interface XMLGrammarLoader
Parameters:
errorHandler - The error handler.

getErrorHandler

public XMLErrorHandler getErrorHandler()
Returns the registered error handler.

Specified by:
getErrorHandler in interface XMLGrammarLoader

setEntityResolver

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

Specified by:
setEntityResolver in interface XMLGrammarLoader
Parameters:
entityResolver - The new entity resolver.

getEntityResolver

public XMLEntityResolver getEntityResolver()
Returns the registered entity resolver.

Specified by:
getEntityResolver in interface XMLGrammarLoader

loadGrammar

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

Specified by:
loadGrammar in interface 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.
XNIException

loadGrammarWithContext

public void loadGrammarWithContext(XMLDTDValidator validator,
                                   java.lang.String rootName,
                                   java.lang.String publicId,
                                   java.lang.String systemId,
                                   java.lang.String baseSystemId,
                                   java.lang.String internalSubset)
                            throws java.io.IOException,
                                   XNIException
Parse a DTD internal and/or external subset and insert the content into the existing DTD grammar owned by the given DTDValidator.

Throws:
java.io.IOException
XNIException