Package org.apache.xerces.impl.dtd
Class XMLDTDLoader
java.lang.Object
org.apache.xerces.impl.dtd.XMLDTDProcessor
org.apache.xerces.impl.dtd.XMLDTDLoader
- All Implemented Interfaces:
org.apache.xerces.xni.grammars.XMLGrammarLoader,org.apache.xerces.xni.parser.XMLComponent,org.apache.xerces.xni.parser.XMLDTDContentModelFilter,org.apache.xerces.xni.parser.XMLDTDContentModelSource,org.apache.xerces.xni.parser.XMLDTDFilter,org.apache.xerces.xni.parser.XMLDTDSource,org.apache.xerces.xni.XMLDTDContentModelHandler,org.apache.xerces.xni.XMLDTDHandler
- Direct Known Subclasses:
XML11DTDProcessor
public class XMLDTDLoader
extends XMLDTDProcessor
implements org.apache.xerces.xni.grammars.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
- http://xml.org/sax/features/namespaces
- http://apache.org/xml/properties/internal/symbol-table
- http://apache.org/xml/properties/internal/error-reporter
- http://apache.org/xml/properties/internal/grammar-pool
- http://apache.org/xml/properties/internal/datatype-validator-factory
INTERNAL:
- Usage of this class is not supported. It may be altered or removed at any time.
- Version:
- $Id: XMLDTDLoader.java 1375056 2012-08-20 15:26:01Z mrglavas $
- Author:
- Neil Graham, IBM, Michael Glavassevich, IBM
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final StringFeature identifier: balance syntax trees.protected static final StringProperty identifier: entity resolver.protected static final StringProperty identifier: error handler.protected XMLDTDScannerImplprotected XMLEntityManagerprotected org.apache.xerces.xni.parser.XMLEntityResolverEntity resolver .protected Localeprotected static final StringProperty identifier: locale.protected static final StringFeature identifier: standard uri conformant feature.Fields inherited from class org.apache.xerces.impl.dtd.XMLDTDProcessor
DTD_VALIDATOR, ERROR_REPORTER, fDTDContentModelHandler, fDTDContentModelSource, fDTDGrammar, fDTDHandler, fDTDSource, fDTDValidation, fErrorReporter, fGrammarBucket, fGrammarPool, fInDTDIgnore, fSymbolTable, fValidation, fValidator, fWarnDuplicateAttdef, fWarnOnUndeclaredElemdef, GRAMMAR_POOL, NOTIFY_CHAR_REFS, PARSER_SETTINGS, SYMBOL_TABLE, VALIDATION, WARN_ON_DUPLICATE_ATTDEF, WARN_ON_UNDECLARED_ELEMDEFFields inherited from interface org.apache.xerces.xni.XMLDTDContentModelHandler
OCCURS_ONE_OR_MORE, OCCURS_ZERO_OR_MORE, OCCURS_ZERO_OR_ONE, SEPARATOR_CHOICE, SEPARATOR_SEQUENCEFields inherited from interface org.apache.xerces.xni.XMLDTDHandler
CONDITIONAL_IGNORE, CONDITIONAL_INCLUDE -
Constructor Summary
ConstructorsConstructorDescriptionDeny default construction; we need a SymtolTable!XMLDTDLoader(SymbolTable symbolTable) XMLDTDLoader(SymbolTable symbolTable, org.apache.xerces.xni.grammars.XMLGrammarPool grammarPool) -
Method Summary
Modifier and TypeMethodDescriptionprotected XMLDTDScannerImplcreateDTDScanner(SymbolTable symbolTable, XMLErrorReporter errorReporter, XMLEntityManager entityManager) org.apache.xerces.xni.parser.XMLEntityResolverReturns the registered entity resolver.org.apache.xerces.xni.parser.XMLErrorHandlerReturns the registered error handler.booleangetFeature(String featureId) Returns the state of a feature.Return the Locale the XMLGrammarLoader is using.getProperty(String propertyId) Returns the state of a property.String[]Returns a list of feature identifiers that are recognized by this component.String[]Returns a list of property identifiers that are recognized by this component.protected shortorg.apache.xerces.xni.grammars.GrammarloadGrammar(org.apache.xerces.xni.parser.XMLInputSource source) Returns a Grammar object by parsing the contents of the entity pointed to by source.voidloadGrammarWithContext(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 voidreset()voidsetEntityResolver(org.apache.xerces.xni.parser.XMLEntityResolver entityResolver) Sets the entity resolver.voidsetErrorHandler(org.apache.xerces.xni.parser.XMLErrorHandler errorHandler) Sets the error handler.voidsetFeature(String featureId, boolean state) Sets the state of a feature.voidSet the locale to use for messages.voidsetProperty(String propertyId, Object value) Sets the value of a property.Methods inherited from class org.apache.xerces.impl.dtd.XMLDTDProcessor
any, attributeDecl, checkStandaloneEntityRef, comment, element, elementDecl, empty, endAttlist, endConditional, endContentModel, endDTD, endExternalSubset, endGroup, endParameterEntity, externalEntityDecl, getDTDContentModelHandler, getDTDContentModelSource, getDTDHandler, getDTDSource, getFeatureDefault, getPropertyDefault, ignoredCharacters, internalEntityDecl, isValidName, isValidNmtoken, notationDecl, occurrence, pcdata, processingInstruction, reset, separator, setDTDContentModelHandler, setDTDContentModelSource, setDTDHandler, setDTDSource, startAttlist, startConditional, startContentModel, startDTD, startExternalSubset, startGroup, startParameterEntity, textDecl, unparsedEntityDecl
-
Field Details
-
STANDARD_URI_CONFORMANT_FEATURE
Feature identifier: standard uri conformant feature.- See Also:
-
BALANCE_SYNTAX_TREES
Feature identifier: balance syntax trees.- See Also:
-
ERROR_HANDLER
Property identifier: error handler.- See Also:
-
ENTITY_RESOLVER
Property identifier: entity resolver.- See Also:
-
LOCALE
Property identifier: locale.- See Also:
-
fEntityResolver
protected org.apache.xerces.xni.parser.XMLEntityResolver fEntityResolverEntity resolver . -
fDTDScanner
-
fEntityManager
-
fLocale
-
-
Constructor Details
-
XMLDTDLoader
public XMLDTDLoader()Deny default construction; we need a SymtolTable! -
XMLDTDLoader
-
XMLDTDLoader
public XMLDTDLoader(SymbolTable symbolTable, org.apache.xerces.xni.grammars.XMLGrammarPool grammarPool)
-
-
Method Details
-
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:
getRecognizedFeaturesin interfaceorg.apache.xerces.xni.parser.XMLComponent- Specified by:
getRecognizedFeaturesin interfaceorg.apache.xerces.xni.grammars.XMLGrammarLoader- Overrides:
getRecognizedFeaturesin classXMLDTDProcessor
-
setFeature
public void setFeature(String featureId, boolean state) throws org.apache.xerces.xni.parser.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:
setFeaturein interfaceorg.apache.xerces.xni.parser.XMLComponent- Specified by:
setFeaturein interfaceorg.apache.xerces.xni.grammars.XMLGrammarLoader- Overrides:
setFeaturein classXMLDTDProcessor- Parameters:
featureId- The feature identifier.state- The state of the feature.
-
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:
getRecognizedPropertiesin interfaceorg.apache.xerces.xni.parser.XMLComponent- Specified by:
getRecognizedPropertiesin interfaceorg.apache.xerces.xni.grammars.XMLGrammarLoader- Overrides:
getRecognizedPropertiesin classXMLDTDProcessor
-
getProperty
public Object getProperty(String propertyId) throws org.apache.xerces.xni.parser.XMLConfigurationException Returns the state of a property.- Specified by:
getPropertyin interfaceorg.apache.xerces.xni.grammars.XMLGrammarLoader- Parameters:
propertyId- The property identifier.- Throws:
org.apache.xerces.xni.parser.XMLConfigurationException- Thrown on configuration error.
-
setProperty
public void setProperty(String propertyId, Object value) throws org.apache.xerces.xni.parser.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:
setPropertyin interfaceorg.apache.xerces.xni.parser.XMLComponent- Specified by:
setPropertyin interfaceorg.apache.xerces.xni.grammars.XMLGrammarLoader- Overrides:
setPropertyin classXMLDTDProcessor- Parameters:
propertyId- The property identifier.value- The value of the property.
-
getFeature
public boolean getFeature(String featureId) throws org.apache.xerces.xni.parser.XMLConfigurationException Returns the state of a feature.- Specified by:
getFeaturein interfaceorg.apache.xerces.xni.grammars.XMLGrammarLoader- Parameters:
featureId- The feature identifier.- Throws:
org.apache.xerces.xni.parser.XMLConfigurationException- Thrown on configuration error.
-
setLocale
Set the locale to use for messages.- Specified by:
setLocalein interfaceorg.apache.xerces.xni.grammars.XMLGrammarLoader- Parameters:
locale- The locale object to use for localization of messages.- Throws:
org.apache.xerces.xni.XNIException- Thrown if the parser does not support the specified locale.
-
getLocale
Return the Locale the XMLGrammarLoader is using.- Specified by:
getLocalein interfaceorg.apache.xerces.xni.grammars.XMLGrammarLoader
-
setErrorHandler
public void setErrorHandler(org.apache.xerces.xni.parser.XMLErrorHandler errorHandler) Sets the error handler.- Specified by:
setErrorHandlerin interfaceorg.apache.xerces.xni.grammars.XMLGrammarLoader- Parameters:
errorHandler- The error handler.
-
getErrorHandler
public org.apache.xerces.xni.parser.XMLErrorHandler getErrorHandler()Returns the registered error handler.- Specified by:
getErrorHandlerin interfaceorg.apache.xerces.xni.grammars.XMLGrammarLoader
-
setEntityResolver
public void setEntityResolver(org.apache.xerces.xni.parser.XMLEntityResolver entityResolver) Sets the entity resolver.- Specified by:
setEntityResolverin interfaceorg.apache.xerces.xni.grammars.XMLGrammarLoader- Parameters:
entityResolver- The new entity resolver.
-
getEntityResolver
public org.apache.xerces.xni.parser.XMLEntityResolver getEntityResolver()Returns the registered entity resolver.- Specified by:
getEntityResolverin interfaceorg.apache.xerces.xni.grammars.XMLGrammarLoader
-
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.- Specified by:
loadGrammarin interfaceorg.apache.xerces.xni.grammars.XMLGrammarLoader- Parameters:
source- the location of the entity which forms the starting point of the grammar to be constructed.- Throws:
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.org.apache.xerces.xni.XNIException
-
loadGrammarWithContext
public void loadGrammarWithContext(XMLDTDValidator validator, String rootName, String publicId, String systemId, String baseSystemId, String internalSubset) throws IOException, org.apache.xerces.xni.XNIException Parse a DTD internal and/or external subset and insert the content into the existing DTD grammar owned by the given DTDValidator.- Throws:
IOExceptionorg.apache.xerces.xni.XNIException
-
reset
protected void reset()- Overrides:
resetin classXMLDTDProcessor
-
createDTDScanner
protected XMLDTDScannerImpl createDTDScanner(SymbolTable symbolTable, XMLErrorReporter errorReporter, XMLEntityManager entityManager) -
getScannerVersion
protected short getScannerVersion()
-