java.lang.Object | |
↳ | org.apache.xerces.impl.XMLEntityManager |
The entity manager handles the registration of general and parameter entities; resolves entities; and starts entities. The entity manager is a central component in a standard parser configuration and this class works directly with the entity scanner to manage the underlying xni.
This component requires the following features and properties from the component manager that uses it:
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
XMLEntityManager.Entity | Entity information.@xerces.internal | ||||||||||
XMLEntityManager.ExternalEntity | External entity.@xerces.internal | ||||||||||
XMLEntityManager.InternalEntity | Internal entity.@xerces.internal | ||||||||||
XMLEntityManager.RewindableInputStream | This class wraps the byte inputstreams we're presented with. | ||||||||||
XMLEntityManager.ScannedEntity | Entity state.@xerces.internal |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | ALLOW_JAVA_ENCODINGS | Feature identifier: allow Java encodings. | |||||||||
String | BUFFER_SIZE | property identifier: buffer size. | |||||||||
int | DEFAULT_BUFFER_SIZE | Default buffer size (2048). | |||||||||
int | DEFAULT_INTERNAL_BUFFER_SIZE | Default internal entity buffer size (512). | |||||||||
int | DEFAULT_XMLDECL_BUFFER_SIZE | Default buffer size before we've finished with the XMLDecl: | |||||||||
String | ENTITY_RESOLVER | Property identifier: entity resolver. | |||||||||
String | ERROR_REPORTER | Property identifier: error reporter. | |||||||||
String | EXTERNAL_GENERAL_ENTITIES | Feature identifier: external general entities. | |||||||||
String | EXTERNAL_PARAMETER_ENTITIES | Feature identifier: external parameter entities. | |||||||||
String | PARSER_SETTINGS | ||||||||||
String | SECURITY_MANAGER | property identifier: security manager. | |||||||||
String | STANDARD_URI_CONFORMANT | Feature identifier: standard uri conformant | |||||||||
String | SYMBOL_TABLE | Property identifier: symbol table. | |||||||||
String | VALIDATION | Feature identifier: validation. | |||||||||
String | VALIDATION_MANAGER | ||||||||||
String | WARN_ON_DUPLICATE_ENTITYDEF | Feature identifier: warn on duplicate EntityDef |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
fAllowJavaEncodings | Allow Java encoding names. | ||||||||||
fBufferSize | Buffer size. | ||||||||||
fCurrentEntity | Current entity. | ||||||||||
fDeclaredEntities | Shared declared entities. | ||||||||||
fEntities | Entities. | ||||||||||
fEntityExpansionCount | |||||||||||
fEntityExpansionLimit | |||||||||||
fEntityHandler | Entity handler. | ||||||||||
fEntityResolver | Entity resolver. | ||||||||||
fEntityScanner | Current entity scanner. | ||||||||||
fEntityStack | Entity stack. | ||||||||||
fErrorReporter | Error reporter. | ||||||||||
fExternalGeneralEntities | External general entities. | ||||||||||
fExternalParameterEntities | External parameter entities. | ||||||||||
fInExternalSubset | |||||||||||
fReaderStack | |||||||||||
fSecurityManager | |||||||||||
fStandalone | True if the document entity is standalone. | ||||||||||
fStrictURI | standard uri conformant (strict uri). | ||||||||||
fSymbolTable | Symbol table. | ||||||||||
fValidation | Validation. | ||||||||||
fValidationManager | Validation manager. | ||||||||||
fWarnDuplicateEntityDef | warn on duplicate Entity declaration. | ||||||||||
fXML10EntityScanner | XML 1.0 entity scanner. | ||||||||||
fXML11EntityScanner | XML 1.1 entity scanner. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Default constructor.
| |||||||||||
Constructs an entity manager that shares the specified entity
declarations during each parse.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Absolutizes a URI using the current value
of the "user.dir" property as the base URI.
| |||||||||||
Adds an external entity declaration.
| |||||||||||
Adds an internal entity declaration.
| |||||||||||
Adds an unparsed entity declaration.
| |||||||||||
Close all opened InputStreams and Readers opened by this parser.
| |||||||||||
Expands a system id and returns the system id as a URI, if
it can be expanded.
| |||||||||||
Returns the entity scanner.
| |||||||||||
Returns the default state for a feature, or null if this
component does not want to report a default value for this
feature.
| |||||||||||
Returns the default state for a property, or null if this
component does not want to report a default value for this
property.
| |||||||||||
Returns a list of feature identifiers that are recognized by
this component.
| |||||||||||
Returns a list of property identifiers that are recognized by
this component.
| |||||||||||
Checks whether an entity given by name is declared.
| |||||||||||
Checks whether the declaration of an entity given by name is
// in the external subset.
| |||||||||||
Checks whether an entity given by name is external.
| |||||||||||
Returns true if the document entity is standalone.
| |||||||||||
Checks whether an entity given by name is unparsed.
| |||||||||||
Resets the component.
| |||||||||||
Resolves the specified public and system identifiers.
| |||||||||||
Sets the entity handler.
| |||||||||||
Sets the state of a feature.
| |||||||||||
Attempt to set whether redirects will be followed for an
HttpURLConnection . | |||||||||||
Sets the value of a property.
| |||||||||||
Sets whether the document entity is standalone.
| |||||||||||
This method uses the passed-in XMLInputSource to make
fCurrentEntity usable for reading.
| |||||||||||
Starts the DTD entity.
| |||||||||||
Starts the document entity.
| |||||||||||
Starts an entity.
| |||||||||||
Starts a named entity.
| |||||||||||
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a reader capable of reading the given input stream in
the specified encoding.
| |||||||||||
Fixes a platform dependent filename to standard URI form.
| |||||||||||
Returns the IANA encoding name that is auto-detected from
the bytes specified, with the endian-ness of that encoding where appropriate.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
org.apache.xerces.xni.parser.XMLComponent
| |||||||||||
From interface
org.apache.xerces.xni.parser.XMLEntityResolver
|
Feature identifier: allow Java encodings.
property identifier: buffer size.
Default buffer size (2048).
Default internal entity buffer size (512).
Default buffer size before we've finished with the XMLDecl:
Property identifier: entity resolver.
Property identifier: error reporter.
Feature identifier: external general entities.
Feature identifier: external parameter entities.
property identifier: security manager.
Feature identifier: standard uri conformant
Property identifier: symbol table.
Feature identifier: validation.
Feature identifier: warn on duplicate EntityDef
Allow Java encoding names. This feature identifier is: http://apache.org/xml/features/allow-java-encodings
Buffer size. We get this value from a property. The default size is used if the input buffer size property is not specified. REVISIT: do we need a property for internal entity buffer size?
Entity resolver. This property identifier is: http://apache.org/xml/properties/internal/entity-resolver
Error reporter. This property identifier is: http://apache.org/xml/properties/internal/error-reporter
External general entities. This feature identifier is: http://xml.org/sax/features/external-general-entities
External parameter entities. This feature identifier is: http://xml.org/sax/features/external-parameter-entities
True if the document entity is standalone. This should really only be set by the document source (e.g. XMLDocumentScanner).
standard uri conformant (strict uri). http://apache.org/xml/features/standard-uri-conformant
Symbol table. This property identifier is: http://apache.org/xml/properties/internal/symbol-table
Validation. This feature identifier is: http://xml.org/sax/features/validation
Validation manager. This property identifier is: http://apache.org/xml/properties/internal/validation-manager
warn on duplicate Entity declaration. http://apache.org/xml/features/warn-on-duplicate-entitydef
Default constructor.
Constructs an entity manager that shares the specified entity declarations during each parse.
REVISIT: We might want to think about the "right" way to expose the list of declared entities. For now, the knowledge how to access the entity declarations is implicit.
Absolutizes a URI using the current value of the "user.dir" property as the base URI. If the URI is already absolute, this is a no-op.
uri | the URI to absolutize |
---|
URI.MalformedURIException |
---|
Adds an external entity declaration.
Note: This method ignores subsequent entity declarations.
Note: The name should be a unique symbol. The SymbolTable can be used for this purpose.
name | The name of the entity. |
---|---|
publicId | The public identifier of the entity. |
literalSystemId | The system identifier of the entity. |
baseSystemId | The base system identifier of the entity. This is the system identifier of the entity where the entity being added and is used to expand the system identifier when the system identifier is a relative URI. When null the system identifier of the first external entity on the stack is used instead. |
IOException |
---|
Adds an internal entity declaration.
Note: This method ignores subsequent entity declarations.
Note: The name should be a unique symbol. The SymbolTable can be used for this purpose.
name | The name of the entity. |
---|---|
text | The text of the entity. |
Adds an unparsed entity declaration.
Note: This method ignores subsequent entity declarations.
Note: The name should be a unique symbol. The SymbolTable can be used for this purpose.
name | The name of the entity. |
---|---|
publicId | The public identifier of the entity. |
systemId | The system identifier of the entity. |
notation | The name of the notation. |
Close all opened InputStreams and Readers opened by this parser.
Expands a system id and returns the system id as a URI, if it can be expanded. A return value of null means that the identifier is already expanded. An exception thrown indicates a failure to expand the id.
systemId | The systemId to be expanded. |
---|
URI.MalformedURIException |
---|
Returns the default state for a feature, or null if this component does not want to report a default value for this feature.
featureId | The feature identifier. |
---|
Returns the default state for a property, or null if this component does not want to report a default value for this property.
propertyId | The property identifier. |
---|
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.
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.
Checks whether an entity given by name is declared.
entityName | The name of the entity to check. |
---|
Checks whether the declaration of an entity given by name is // in the external subset.
entityName | The name of the entity to check. |
---|
Checks whether an entity given by name is external.
entityName | The name of the entity to check. |
---|
Returns true if the document entity is standalone.
Checks whether an entity given by name is unparsed.
entityName | The name of the entity to check. |
---|
Resets the component. The component can query the component manager about any features and properties that affect the operation of the component.
componentManager | The component manager. |
---|
Thrown by component on initialization error. For example, if a feature or property is required for the operation of the component, the component manager may throw a SAXNotRecognizedException or a SAXNotSupportedException. | |
XMLConfigurationException |
Resolves the specified public and system identifiers. This method first attempts to resolve the entity based on the EntityResolver registered by the application. If no entity resolver is registered or if the registered entity handler is unable to resolve the entity, then default entity resolution will occur.
resourceIdentifier | The XMLResourceIdentifier for the resource to resolve. |
---|
IOException | Thrown on i/o error. |
---|---|
XNIException | Thrown by entity resolver to signal an error. |
Sets the entity handler. When an entity starts and ends, the entity handler is notified of the change.
entityHandler | The new entity handler. |
---|
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.
featureId | The feature identifier. |
---|---|
state | The state of the feature. |
The component should not throw this exception. | |
The component should not throw this exception. | |
XMLConfigurationException |
Attempt to set whether redirects will be followed for an HttpURLConnection
.
This may fail on earlier JDKs which do not support setting this preference.
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.
propertyId | The property identifier. |
---|---|
value | The value of the property. |
The component should not throw this exception. | |
The component should not throw this exception. | |
XMLConfigurationException |
Sets whether the document entity is standalone.
standalone | True if document entity is standalone. |
---|
This method uses the passed-in XMLInputSource to make fCurrentEntity usable for reading.
name | name of the entity (XML is it's the document entity) |
---|---|
xmlInputSource | the input source, with sufficient information to begin scanning characters. |
literal | True if this entity is started within a literal value. |
isExternal | whether this entity should be treated as an internal or external entity. |
IOException | if anything can't be read XNIException If any parser-specific goes wrong. |
---|---|
XNIException |
Starts the DTD entity. The DTD entity has the "[dtd]" pseudo-name.
xmlInputSource | The input source of the DTD entity. |
---|
IOException | Thrown on i/o error. |
---|---|
XNIException | Thrown by entity handler to signal an error. |
Starts the document entity. The document entity has the "[xml]" pseudo-name.
xmlInputSource | The input source of the document entity. |
---|
IOException | Thrown on i/o error. |
---|---|
XNIException | Thrown by entity handler to signal an error. |
Starts an entity.
This method can be used to insert an application defined XML entity stream into the parsing stream.
name | The name of the entity. |
---|---|
xmlInputSource | The input source of the entity. |
literal | True if this entity is started within a literal value. |
isExternal | whether this entity should be treated as an internal or external entity. |
IOException | Thrown on i/o error. |
---|---|
XNIException | Thrown by entity handler to signal an error. |
Starts a named entity.
entityName | The name of the entity to start. |
---|---|
literal | True if this entity is started within a literal value. |
IOException | Thrown on i/o error. |
---|---|
XNIException | Thrown by entity handler to signal an error. |
Creates a reader capable of reading the given input stream in the specified encoding.
inputStream | The input stream. |
---|---|
encoding | The encoding name that the input stream is encoded using. If the user has specified that Java encoding names are allowed, then the encoding name may be a Java encoding name; otherwise, it is an ianaEncoding name. |
isBigEndian | For encodings (like uCS-4), whose names cannot specify a byte order, this tells whether the order is bigEndian. null menas unknown or not relevant. |
IOException |
---|
Fixes a platform dependent filename to standard URI form.
str | The string to fix. |
---|
Returns the IANA encoding name that is auto-detected from the bytes specified, with the endian-ness of that encoding where appropriate.
b4 | The first four bytes of the input. |
---|---|
count | The number of bytes actually read. |