Class XMLDTDLoader
- java.lang.Object
-
- org.smooks.engine.delivery.sax.ng.org.apache.xerces.impl.dtd.XMLDTDProcessor
-
- org.smooks.engine.delivery.sax.ng.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
- 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
- Version:
- $Id$
- Author:
- Neil Graham, IBM, Michael Glavassevich, IBM
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
BALANCE_SYNTAX_TREES
Feature identifier: balance syntax trees.protected static String
ENTITY_RESOLVER
Property identifier: entity resolver.protected static String
ERROR_HANDLER
Property identifier: error handler.protected XMLDTDScannerImpl
fDTDScanner
protected XMLEntityManager
fEntityManager
protected XMLEntityResolver
fEntityResolver
Entity resolver .protected Locale
fLocale
protected static String
LOCALE
Property identifier: locale.protected static String
STANDARD_URI_CONFORMANT_FEATURE
Feature identifier: standard uri conformant feature.-
Fields inherited from class org.smooks.engine.delivery.sax.ng.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_ELEMDEF
-
Fields inherited from interface org.smooks.engine.delivery.sax.ng.org.apache.xerces.xni.XMLDTDContentModelHandler
OCCURS_ONE_OR_MORE, OCCURS_ZERO_OR_MORE, OCCURS_ZERO_OR_ONE, SEPARATOR_CHOICE, SEPARATOR_SEQUENCE
-
Fields inherited from interface org.smooks.engine.delivery.sax.ng.org.apache.xerces.xni.XMLDTDHandler
CONDITIONAL_IGNORE, CONDITIONAL_INCLUDE
-
-
Constructor Summary
Constructors Constructor Description XMLDTDLoader()
Deny default construction; we need a SymtolTable!XMLDTDLoader(SymbolTable symbolTable)
XMLDTDLoader(SymbolTable symbolTable, XMLGrammarPool grammarPool)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected XMLDTDScannerImpl
createDTDScanner(SymbolTable symbolTable, XMLErrorReporter errorReporter, XMLEntityManager entityManager)
XMLEntityResolver
getEntityResolver()
Returns the registered entity resolver.XMLErrorHandler
getErrorHandler()
Returns the registered error handler.boolean
getFeature(String featureId)
Returns the state of a feature.Locale
getLocale()
Return the Locale the XMLGrammarLoader is using.Object
getProperty(String propertyId)
Returns the state of a property.String[]
getRecognizedFeatures()
Returns a list of feature identifiers that are recognized by this component.String[]
getRecognizedProperties()
Returns a list of property identifiers that are recognized by this component.protected short
getScannerVersion()
Grammar
loadGrammar(XMLInputSource source)
Returns a Grammar object by parsing the contents of the entity pointed to by source.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
reset()
void
setEntityResolver(XMLEntityResolver entityResolver)
Sets the entity resolver.void
setErrorHandler(XMLErrorHandler errorHandler)
Sets the error handler.void
setFeature(String featureId, boolean state)
Sets the state of a feature.void
setLocale(Locale locale)
Set the locale to use for messages.void
setProperty(String propertyId, Object value)
Sets the value of a property.-
Methods inherited from class org.smooks.engine.delivery.sax.ng.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 Detail
-
STANDARD_URI_CONFORMANT_FEATURE
protected static final String STANDARD_URI_CONFORMANT_FEATURE
Feature identifier: standard uri conformant feature.- See Also:
- Constant Field Values
-
BALANCE_SYNTAX_TREES
protected static final String BALANCE_SYNTAX_TREES
Feature identifier: balance syntax trees.- See Also:
- Constant Field Values
-
ERROR_HANDLER
protected static final String ERROR_HANDLER
Property identifier: error handler.- See Also:
- Constant Field Values
-
ENTITY_RESOLVER
protected static final String ENTITY_RESOLVER
Property identifier: entity resolver.- See Also:
- Constant Field Values
-
LOCALE
protected static final String LOCALE
Property identifier: locale.- See Also:
- Constant Field Values
-
fEntityResolver
protected XMLEntityResolver fEntityResolver
Entity resolver .
-
fDTDScanner
protected XMLDTDScannerImpl fDTDScanner
-
fEntityManager
protected XMLEntityManager fEntityManager
-
fLocale
protected Locale fLocale
-
-
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 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 interfaceXMLComponent
- Specified by:
getRecognizedFeatures
in interfaceXMLGrammarLoader
- Overrides:
getRecognizedFeatures
in classXMLDTDProcessor
-
setFeature
public void setFeature(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 interfaceXMLComponent
- Specified by:
setFeature
in interfaceXMLGrammarLoader
- Overrides:
setFeature
in classXMLDTDProcessor
- 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 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 interfaceXMLComponent
- Specified by:
getRecognizedProperties
in interfaceXMLGrammarLoader
- Overrides:
getRecognizedProperties
in classXMLDTDProcessor
-
getProperty
public Object getProperty(String propertyId) throws XMLConfigurationException
Returns the state of a property.- Specified by:
getProperty
in interfaceXMLGrammarLoader
- Parameters:
propertyId
- The property identifier.- Throws:
XMLConfigurationException
- Thrown on configuration error.
-
setProperty
public void setProperty(String propertyId, 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 interfaceXMLComponent
- Specified by:
setProperty
in interfaceXMLGrammarLoader
- Overrides:
setProperty
in classXMLDTDProcessor
- 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(String featureId) throws XMLConfigurationException
Returns the state of a feature.- Specified by:
getFeature
in interfaceXMLGrammarLoader
- Parameters:
featureId
- The feature identifier.- Throws:
XMLConfigurationException
- Thrown on configuration error.
-
setLocale
public void setLocale(Locale locale)
Set the locale to use for messages.- Specified by:
setLocale
in interfaceXMLGrammarLoader
- 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 Locale getLocale()
Return the Locale the XMLGrammarLoader is using.- Specified by:
getLocale
in interfaceXMLGrammarLoader
-
setErrorHandler
public void setErrorHandler(XMLErrorHandler errorHandler)
Sets the error handler.- Specified by:
setErrorHandler
in interfaceXMLGrammarLoader
- Parameters:
errorHandler
- The error handler.
-
getErrorHandler
public XMLErrorHandler getErrorHandler()
Returns the registered error handler.- Specified by:
getErrorHandler
in interfaceXMLGrammarLoader
-
setEntityResolver
public void setEntityResolver(XMLEntityResolver entityResolver)
Sets the entity resolver.- Specified by:
setEntityResolver
in interfaceXMLGrammarLoader
- Parameters:
entityResolver
- The new entity resolver.
-
getEntityResolver
public XMLEntityResolver getEntityResolver()
Returns the registered entity resolver.- Specified by:
getEntityResolver
in interfaceXMLGrammarLoader
-
loadGrammar
public Grammar loadGrammar(XMLInputSource source) throws IOException, XNIException
Returns a Grammar object by parsing the contents of the entity pointed to by source.- Specified by:
loadGrammar
in interfaceXMLGrammarLoader
- 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.XNIException
-
loadGrammarWithContext
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.- Throws:
IOException
XNIException
-
reset
protected void reset()
- Overrides:
reset
in classXMLDTDProcessor
-
createDTDScanner
protected XMLDTDScannerImpl createDTDScanner(SymbolTable symbolTable, XMLErrorReporter errorReporter, XMLEntityManager entityManager)
-
getScannerVersion
protected short getScannerVersion()
-
-