org.apache.xerces.impl.dtd

Class XMLDTDLoader

Implemented Interfaces:
org.apache.xerces.xni.parser.XMLComponent, org.apache.xerces.xni.parser.XMLDTDContentModelFilter, org.apache.xerces.xni.parser.XMLDTDFilter, org.apache.xerces.xni.grammars.XMLGrammarLoader
Known Direct 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

Version:
$Id: XMLDTDLoader.java 373451 2006-01-30 06:38:26Z mrglavas $
Authors:
Neil Graham, IBM
Michael Glavassevich, IBM

Field Summary

protected static String
BALANCE_SYNTAX_TREES
Feature identifier: balance syntax trees.
static String
ENTITY_RESOLVER
Property identifier: entity resolver.
protected static String
ERROR_HANDLER
Property identifier: error handler.
protected static String
STANDARD_URI_CONFORMANT_FEATURE
Feature identifier: standard uri conformant feature.
protected XMLDTDScannerImpl
fDTDScanner
protected XMLEntityManager
fEntityManager
protected org.apache.xerces.xni.parser.XMLEntityResolver
fEntityResolver
Entity resolver .
protected Locale
fLocale

Fields inherited from class org.apache.xerces.impl.dtd.XMLDTDProcessor

DTD_VALIDATOR, ERROR_REPORTER, GRAMMAR_POOL, NOTIFY_CHAR_REFS, PARSER_SETTINGS, SYMBOL_TABLE, VALIDATION, WARN_ON_DUPLICATE_ATTDEF, WARN_ON_UNDECLARED_ELEMDEF, fDTDContentModelHandler, fDTDContentModelSource, fDTDGrammar, fDTDHandler, fDTDSource, fDTDValidation, fErrorReporter, fGrammarBucket, fGrammarPool, fInDTDIgnore, fLocale, fSymbolTable, fValidation, fValidator, fWarnDuplicateAttdef, fWarnOnUndeclaredElemdef

Constructor Summary

XMLDTDLoader()
Deny default construction; we need a SymtolTable!
XMLDTDLoader(SymbolTable symbolTable)
XMLDTDLoader(SymbolTable symbolTable, org.apache.xerces.xni.grammars.XMLGrammarPool grammarPool)

Method Summary

protected XMLDTDScannerImpl
createDTDScanner(SymbolTable symbolTable, XMLErrorReporter errorReporter, XMLEntityManager entityManager)
org.apache.xerces.xni.parser.XMLEntityResolver
getEntityResolver()
Returns the registered entity resolver.
org.apache.xerces.xni.parser.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()
org.apache.xerces.xni.grammars.Grammar
loadGrammar(org.apache.xerces.xni.parser.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(org.apache.xerces.xni.parser.XMLEntityResolver entityResolver)
Sets the entity resolver.
void
setErrorHandler(org.apache.xerces.xni.parser.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.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, getRecognizedFeatures, getRecognizedProperties, ignoredCharacters, internalEntityDecl, isValidName, isValidNmtoken, notationDecl, occurrence, pcdata, processingInstruction, reset, reset, separator, setDTDContentModelHandler, setDTDContentModelSource, setDTDHandler, setDTDSource, setFeature, setProperty, startAttlist, startConditional, startContentModel, startDTD, startExternalSubset, startGroup, startParameterEntity, textDecl, unparsedEntityDecl

Field Details

BALANCE_SYNTAX_TREES

protected static final String BALANCE_SYNTAX_TREES
Feature identifier: balance syntax trees.

ENTITY_RESOLVER

public static final String ENTITY_RESOLVER
Property identifier: entity resolver.

ERROR_HANDLER

protected static final String ERROR_HANDLER
Property identifier: error handler.

STANDARD_URI_CONFORMANT_FEATURE

protected static final String STANDARD_URI_CONFORMANT_FEATURE
Feature identifier: standard uri conformant feature.

fDTDScanner

protected XMLDTDScannerImpl fDTDScanner

fEntityManager

protected XMLEntityManager fEntityManager

fEntityResolver

protected org.apache.xerces.xni.parser.XMLEntityResolver fEntityResolver
Entity resolver .

fLocale

protected Locale fLocale

Constructor Details

XMLDTDLoader

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

XMLDTDLoader

public XMLDTDLoader(SymbolTable symbolTable)

XMLDTDLoader

public XMLDTDLoader(SymbolTable symbolTable,
                    org.apache.xerces.xni.grammars.XMLGrammarPool grammarPool)

Method Details

createDTDScanner

protected XMLDTDScannerImpl createDTDScanner(SymbolTable symbolTable,
                                             XMLErrorReporter errorReporter,
                                             XMLEntityManager entityManager)

getEntityResolver

public org.apache.xerces.xni.parser.XMLEntityResolver getEntityResolver()
Returns the registered entity resolver.
Specified by:
getEntityResolver in interface org.apache.xerces.xni.grammars.XMLGrammarLoader

getErrorHandler

public org.apache.xerces.xni.parser.XMLErrorHandler getErrorHandler()
Returns the registered error handler.
Specified by:
getErrorHandler in interface org.apache.xerces.xni.grammars.XMLGrammarLoader

getFeature

public boolean getFeature(String featureId)
            throws org.apache.xerces.xni.parser.XMLConfigurationException
Returns the state of a feature.
Specified by:
getFeature in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
Parameters:
featureId - The feature identifier.
Throws:
org.apache.xerces.xni.parser.XMLConfigurationException - Thrown on configuration error.

getLocale

public Locale getLocale()
Return the Locale the XMLGrammarLoader is using.
Specified by:
getLocale in interface org.apache.xerces.xni.grammars.XMLGrammarLoader

getProperty

public Object getProperty(String propertyId)
            throws org.apache.xerces.xni.parser.XMLConfigurationException
Returns the state of a property.
Specified by:
getProperty in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
Parameters:
propertyId - The property identifier.
Throws:
org.apache.xerces.xni.parser.XMLConfigurationException - Thrown on configuration error.

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 interface org.apache.xerces.xni.grammars.XMLGrammarLoader
getRecognizedFeatures in interface org.apache.xerces.xni.parser.XMLComponent
Overrides:
getRecognizedFeatures in interface XMLDTDProcessor

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 interface org.apache.xerces.xni.grammars.XMLGrammarLoader
getRecognizedProperties in interface org.apache.xerces.xni.parser.XMLComponent
Overrides:
getRecognizedProperties in interface XMLDTDProcessor

getScannerVersion

protected short getScannerVersion()

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:
loadGrammar in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
Parameters:
source - the location of the entity which forms the starting point of the grammar to be constructed.

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.

reset

protected void reset()
Overrides:
reset in interface XMLDTDProcessor

setEntityResolver

public void setEntityResolver(org.apache.xerces.xni.parser.XMLEntityResolver entityResolver)
Sets the entity resolver.
Specified by:
setEntityResolver in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
Parameters:
entityResolver - The new entity resolver.

setErrorHandler

public void setErrorHandler(org.apache.xerces.xni.parser.XMLErrorHandler errorHandler)
Sets the error handler.
Specified by:
setErrorHandler in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
Parameters:
errorHandler - The error handler.

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:
setFeature in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
setFeature in interface org.apache.xerces.xni.parser.XMLComponent
Overrides:
setFeature in interface XMLDTDProcessor
Parameters:
featureId - The feature identifier.
state - The state of the feature.

setLocale

public void setLocale(Locale locale)
Set the locale to use for messages.
Specified by:
setLocale in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
Parameters:
locale - The locale object to use for localization of messages.

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:
setProperty in interface org.apache.xerces.xni.grammars.XMLGrammarLoader
setProperty in interface org.apache.xerces.xni.parser.XMLComponent
Overrides:
setProperty in interface XMLDTDProcessor
Parameters:
propertyId - The property identifier.
value - The value of the property.

Copyright B) 1999-2006 The Apache Software Foundation. All Rights Reserved.