Top Description Fields Constructors Methods
org.apache.xerces.impl.dtd

public Class XMLDTDLoader

extends XMLDTDProcessor
implements XMLGrammarLoader
Class Inheritance
All Implemented Interfaces
org.apache.xerces.xni.grammars.XMLGrammarLoader
Known Direct Subclasses
org.apache.xerces.impl.dtd.XML11DTDProcessor
Imports
java.io.EOFException, .IOException, .StringReader, java.util.Locale, org.apache.xerces.impl.Constants, .XMLDTDScannerImpl, .XMLEntityManager, .XMLErrorReporter, org.apache.xerces.impl.msg.XMLMessageFormatter, org.apache.xerces.util.DefaultErrorHandler, .SymbolTable, org.apache.xerces.xni.XNIException, org.apache.xerces.xni.grammars.Grammar, .XMLGrammarLoader, .XMLGrammarPool, org.apache.xerces.xni.parser.XMLConfigurationException, .XMLEntityResolver, .XMLErrorHandler, .XMLInputSource

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

Authors
Neil Graham, IBM, Michael Glavassevich, IBM
Version
$Id: XMLDTDLoader.java 1375056 2012-08-20 15:26:01Z mrglavas $

Field Summary

Modifier and TypeField and Description
protected static final String
BALANCE_SYNTAX_TREES

Feature identifier: balance syntax trees.

protected static final String
ENTITY_RESOLVER

Property identifier: entity resolver.

protected static final String
ERROR_HANDLER

Property identifier: error handler.

private boolean
fBalanceSyntaxTrees

Controls whether the DTD grammar produces balanced syntax trees.

protected XMLDTDScannerImpl
protected XMLEntityManager
protected XMLEntityResolver
fEntityResolver

Entity resolver .

protected Locale
private boolean
private static final String[]
private static final String[]
LOADER_RECOGNIZED_PROPERTIES

Recognized properties.

protected static final String
LOCALE

Property identifier: locale.

protected static final String
STANDARD_URI_CONFORMANT_FEATURE

Feature identifier: standard uri conformant feature.

Inherited from org.apache.xerces.impl.dtd.XMLDTDProcessor:
DTD_VALIDATORERROR_REPORTERfDTDContentModelHandlerfDTDContentModelSourcefDTDGrammarfDTDHandlerfDTDSourcefDTDValidationfErrorReporterfGrammarBucketfGrammarPoolfInDTDIgnorefSymbolTablefValidationfValidatorfWarnDuplicateAttdeffWarnOnUndeclaredElemdefGRAMMAR_POOLNOTIFY_CHAR_REFSPARSER_SETTINGSSYMBOL_TABLEVALIDATIONWARN_ON_DUPLICATE_ATTDEFWARN_ON_UNDECLARED_ELEMDEF

Constructor Summary

AccessConstructor and Description
public
XMLDTDLoader()

Deny default construction; we need a SymtolTable!

public
public
XMLDTDLoader(SymbolTable symbolTable, XMLGrammarPool grammarPool)

pack-priv
XMLDTDLoader(SymbolTable symbolTable, XMLGrammarPool grammarPool, XMLErrorReporter errorReporter, XMLEntityResolver entityResolver)

Method Summary

Modifier and TypeMethod and Description
protected XMLDTDScannerImpl
createDTDScanner(SymbolTable symbolTable, XMLErrorReporter errorReporter, XMLEntityManager entityManager)

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 Locale
getLocale()

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

Return the Locale the XMLGrammarLoader is using.
public Object
getProperty(String
The property identifier.
propertyId
)

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

Returns the state of a property.
public String[]
public String[]
protected short
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 void
loadGrammarWithContext(XMLDTDValidator validator, String rootName, String publicId, String systemId, String baseSystemId, String internalSubset)

Parse a DTD internal and/or external subset and insert the content into the existing DTD grammar owned by the given DTDValidator.

protected void
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
)

Overrides org.apache.xerces.impl.dtd.XMLDTDProcessor.setFeature.

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
setProperty(String
The property identifier.
propertyId
,
Object
The value of the property.
value
)

Overrides org.apache.xerces.impl.dtd.XMLDTDProcessor.setProperty.

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

Sets the value of a property.
Inherited from org.apache.xerces.impl.dtd.XMLDTDProcessor:
anyattributeDeclcheckStandaloneEntityRefcommentelementelementDeclemptyendAttlistendConditionalendContentModelendDTDendExternalSubsetendGroupendParameterEntityexternalEntityDeclgetDTDContentModelHandlergetDTDContentModelSourcegetDTDHandlergetDTDSourcegetFeatureDefaultgetPropertyDefaultignoredCharactersinternalEntityDeclisValidNameisValidNmtokennotationDecloccurrencepcdataprocessingInstructionresetseparatorsetDTDContentModelHandlersetDTDContentModelSourcesetDTDHandlersetDTDSourcestartAttliststartConditionalstartContentModelstartDTDstartExternalSubsetstartGroupstartParameterEntitytextDeclunparsedEntityDecl

Field Detail

BALANCE_SYNTAX_TREESback to summary
protected static final String BALANCE_SYNTAX_TREES

Feature identifier: balance syntax trees.

ENTITY_RESOLVERback to summary
protected static final String ENTITY_RESOLVER

Property identifier: entity resolver.

ERROR_HANDLERback to summary
protected static final String ERROR_HANDLER

Property identifier: error handler.

fBalanceSyntaxTreesback to summary
private boolean fBalanceSyntaxTrees

Controls whether the DTD grammar produces balanced syntax trees.

fDTDScannerback to summary
protected XMLDTDScannerImpl fDTDScanner
fEntityManagerback to summary
protected XMLEntityManager fEntityManager
fEntityResolverback to summary
protected XMLEntityResolver fEntityResolver

Entity resolver .

fLocaleback to summary
protected Locale fLocale

Hides org.apache.xerces.impl.dtd.XMLDTDProcessor.fLocale.

fStrictURIback to summary
private boolean fStrictURI
LOADER_RECOGNIZED_FEATURESback to summary
private static final String[] LOADER_RECOGNIZED_FEATURES
LOADER_RECOGNIZED_PROPERTIESback to summary
private static final String[] LOADER_RECOGNIZED_PROPERTIES

Recognized properties.

LOCALEback to summary
protected static final String LOCALE

Property identifier: locale.

STANDARD_URI_CONFORMANT_FEATUREback to summary
protected static final String STANDARD_URI_CONFORMANT_FEATURE

Feature identifier: standard uri conformant feature.

Constructor Detail

XMLDTDLoaderback to summary
public XMLDTDLoader()

Deny default construction; we need a SymtolTable!

XMLDTDLoaderback to summary
public XMLDTDLoader(SymbolTable symbolTable)
XMLDTDLoaderback to summary
public XMLDTDLoader(SymbolTable symbolTable, XMLGrammarPool grammarPool)
XMLDTDLoaderback to summary
pack-priv XMLDTDLoader(SymbolTable symbolTable, XMLGrammarPool grammarPool, XMLErrorReporter errorReporter, XMLEntityResolver entityResolver)

Method Detail

createDTDScannerback to summary
protected XMLDTDScannerImpl createDTDScanner(SymbolTable symbolTable, XMLErrorReporter errorReporter, XMLEntityManager entityManager)
getEntityResolverback to summary
public XMLEntityResolver getEntityResolver()

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

Returns the registered entity resolver.

getErrorHandlerback to summary
public XMLErrorHandler getErrorHandler()

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

Returns the registered error handler.

getFeatureback to summary
public boolean getFeature(String featureId) throws XMLConfigurationException

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

Returns the state of a feature.

Parameters
featureId:String

The feature identifier.

Exceptions
XMLConfigurationException:
Thrown on configuration error.
getLocaleback to summary
public Locale getLocale()

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

Return the Locale the XMLGrammarLoader is using.

getPropertyback to summary
public Object getProperty(String propertyId) throws XMLConfigurationException

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

Returns the state of a property.

Parameters
propertyId:String

The property identifier.

Exceptions
XMLConfigurationException:
Thrown on configuration error.
getRecognizedFeaturesback to summary
public String[] getRecognizedFeatures()

Overrides org.apache.xerces.impl.dtd.XMLDTDProcessor.getRecognizedFeatures.

Implements org.apache.xerces.xni.grammars.XMLGrammarLoader.getRecognizedFeatures, org.apache.xerces.xni.parser.XMLComponent.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.

getRecognizedPropertiesback to summary
public String[] getRecognizedProperties()

Overrides org.apache.xerces.impl.dtd.XMLDTDProcessor.getRecognizedProperties.

Implements org.apache.xerces.xni.grammars.XMLGrammarLoader.getRecognizedProperties, org.apache.xerces.xni.parser.XMLComponent.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.

getScannerVersionback to summary
protected short getScannerVersion()
loadGrammarback to summary
public Grammar loadGrammar(XMLInputSource source) throws IOException, XNIException

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

Returns a Grammar object by parsing the contents of the entity pointed to by source.

Parameters
source:XMLInputSource

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

Exceptions
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.
loadGrammarWithContextback to summary
public void loadGrammarWithContext(XMLDTDValidator validator, String rootName, String publicId, String systemId, String baseSystemId, String internalSubset) throws IOException, XNIException

Parse a DTD internal and/or external subset and insert the content into the existing DTD grammar owned by the given DTDValidator.

resetback to summary
protected void reset()

Overrides org.apache.xerces.impl.dtd.XMLDTDProcessor.reset.

setEntityResolverback to summary
public void setEntityResolver(XMLEntityResolver entityResolver)

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

Sets the entity resolver.

Parameters
entityResolver:XMLEntityResolver

The new entity resolver.

setErrorHandlerback to summary
public void setErrorHandler(XMLErrorHandler errorHandler)

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

Sets the error handler.

Parameters
errorHandler:XMLErrorHandler

The error handler.

setFeatureback to summary
public void setFeature(String featureId, boolean state) throws XMLConfigurationException

Overrides org.apache.xerces.impl.dtd.XMLDTDProcessor.setFeature.

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

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.

Parameters
featureId:String

The feature identifier.

state:boolean

The state of the feature.

Exceptions
XMLConfigurationException:

Doc from org.apache.xerces.xni.grammars.XMLGrammarLoader.setFeature.

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

SAXNotRecognizedException:
The component should not throw this exception.
SAXNotSupportedException:
The component should not throw this exception.
setLocaleback to summary
public void setLocale(Locale locale)

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

Set the locale to use for messages.

Parameters
locale:Locale

The locale object to use for localization of messages.

Exceptions
XNIException:
Thrown if the parser does not support the specified locale.
setPropertyback to summary
public void setProperty(String propertyId, Object value) throws XMLConfigurationException

Overrides org.apache.xerces.impl.dtd.XMLDTDProcessor.setProperty.

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

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.

Parameters
propertyId:String

The property identifier.

value:Object

The value of the property.

Exceptions
XMLConfigurationException:

Doc from org.apache.xerces.xni.grammars.XMLGrammarLoader.setProperty.

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

SAXNotRecognizedException:
The component should not throw this exception.
SAXNotSupportedException:
The component should not throw this exception.