org.apache.xerces.impl
public class XMLEntityManager extends Object implements XMLComponent, XMLEntityResolver
This component requires the following features and properties from the component manager that uses it:
Version: $Id: XMLEntityManager.java,v 1.94 2005/04/19 03:18:18 mrglavas Exp $
UNKNOWN:
Nested Class Summary | |
---|---|
abstract static class | XMLEntityManager.Entity
Entity information.
|
protected static class | XMLEntityManager.ExternalEntity
External entity.
|
protected static class | XMLEntityManager.InternalEntity
Internal entity.
|
protected class | XMLEntityManager.RewindableInputStream
This class wraps the byte inputstreams we're presented with.
|
class | XMLEntityManager.ScannedEntity
Entity state.
|
Field Summary | |
---|---|
protected static String | ALLOW_JAVA_ENCODINGS Feature identifier: allow Java encodings. |
protected static String | BUFFER_SIZE property identifier: buffer size. |
static int | DEFAULT_BUFFER_SIZE Default buffer size (2048). |
static int | DEFAULT_INTERNAL_BUFFER_SIZE Default internal entity buffer size (512). |
static int | DEFAULT_XMLDECL_BUFFER_SIZE Default buffer size before we've finished with the XMLDecl: |
protected static String | ENTITY_RESOLVER Property identifier: entity resolver. |
protected static String | ERROR_REPORTER Property identifier: error reporter. |
protected static String | EXTERNAL_GENERAL_ENTITIES Feature identifier: external general entities. |
protected static String | EXTERNAL_PARAMETER_ENTITIES Feature identifier: external parameter entities. |
protected boolean | fAllowJavaEncodings
Allow Java encoding names. |
protected int | fBufferSize
Buffer size. |
protected XMLEntityManager.ScannedEntity | fCurrentEntity Current entity. |
protected Hashtable | fDeclaredEntities Shared declared entities. |
protected Hashtable | fEntities Entities. |
protected int | fEntityExpansionCount |
protected int | fEntityExpansionLimit |
protected XMLEntityHandler | fEntityHandler Entity handler. |
protected XMLEntityResolver | fEntityResolver
Entity resolver. |
protected XMLEntityScanner | fEntityScanner Current entity scanner. |
protected Stack | fEntityStack Entity stack. |
protected XMLErrorReporter | fErrorReporter
Error reporter. |
protected boolean | fExternalGeneralEntities
External general entities. |
protected boolean | fExternalParameterEntities
External parameter entities. |
protected boolean | fInExternalSubset |
protected Stack | fReaderStack |
protected SecurityManager | fSecurityManager |
protected boolean | fStandalone
True if the document entity is standalone. |
protected boolean | fStrictURI
standard uri conformant (strict uri).
http://apache.org/xml/features/standard-uri-conformant |
protected SymbolTable | fSymbolTable
Symbol table. |
protected boolean | fValidation
Validation. |
protected ValidationManager | fValidationManager
Validation manager. |
protected boolean | fWarnDuplicateEntityDef warn on duplicate Entity declaration.
http://apache.org/xml/features/warn-on-duplicate-entitydef |
protected XMLEntityScanner | fXML10EntityScanner XML 1.0 entity scanner. |
protected XMLEntityScanner | fXML11EntityScanner XML 1.1 entity scanner. |
protected static String | PARSER_SETTINGS |
protected static String | SECURITY_MANAGER property identifier: security manager. |
protected static String | STANDARD_URI_CONFORMANT Feature identifier: standard uri conformant |
protected static String | SYMBOL_TABLE Property identifier: symbol table. |
protected static String | VALIDATION Feature identifier: validation. |
protected static String | VALIDATION_MANAGER |
protected static String | WARN_ON_DUPLICATE_ENTITYDEF Feature identifier: warn on duplicate EntityDef |
Constructor Summary | |
---|---|
XMLEntityManager() Default constructor. | |
XMLEntityManager(XMLEntityManager entityManager)
Constructs an entity manager that shares the specified entity
declarations during each parse.
|
Method Summary | |
---|---|
static void | absolutizeAgainstUserDir(URI uri)
Absolutizes a URI using the current value
of the "user.dir" property as the base URI. |
void | addExternalEntity(String name, String publicId, String literalSystemId, String baseSystemId)
Adds an external entity declaration.
|
void | addInternalEntity(String name, String text)
Adds an internal entity declaration.
|
void | addUnparsedEntity(String name, String publicId, String systemId, String baseSystemId, String notation)
Adds an unparsed entity declaration.
|
void | closeReaders()
Close all opened InputStreams and Readers opened by this parser. |
protected Reader | createReader(InputStream inputStream, String encoding, Boolean isBigEndian)
Creates a reader capable of reading the given input stream in
the specified encoding.
|
void | endExternalSubset() |
static String | expandSystemId(String systemId, String baseSystemId, boolean strict)
Expands a system id and returns the system id as a URI, if
it can be expanded. |
protected static String | fixURI(String str)
Fixes a platform dependent filename to standard URI form.
|
XMLEntityManager.ScannedEntity | getCurrentEntity() |
XMLResourceIdentifier | getCurrentResourceIdentifier() |
protected Object[] | getEncodingName(byte[] b4, int count)
Returns the IANA encoding name that is auto-detected from
the bytes specified, with the endian-ness of that encoding where appropriate.
|
XMLEntityScanner | getEntityScanner() Returns the entity scanner. |
Boolean | getFeatureDefault(String featureId)
Returns the default state for a feature, or null if this
component does not want to report a default value for this
feature.
|
Object | getPropertyDefault(String propertyId)
Returns the default state for a property, or null if this
component does not want to report a default value for this
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. |
boolean | isDeclaredEntity(String entityName)
Checks whether an entity given by name is declared.
|
boolean | isEntityDeclInExternalSubset(String entityName)
Checks whether the declaration of an entity given by name is
// in the external subset.
|
boolean | isExternalEntity(String entityName)
Checks whether an entity given by name is external.
|
boolean | isStandalone() Returns true if the document entity is standalone. |
boolean | isUnparsedEntity(String entityName)
Checks whether an entity given by name is unparsed.
|
void | reset(XMLComponentManager componentManager)
Resets the component. |
void | reset() |
XMLInputSource | resolveEntity(XMLResourceIdentifier resourceIdentifier)
Resolves the specified public and system identifiers. |
void | setEntityHandler(XMLEntityHandler entityHandler)
Sets the entity handler. |
void | setFeature(String featureId, boolean state)
Sets the state of a feature. |
static void | setInstanceFollowRedirects(HttpURLConnection urlCon, boolean followRedirects)
Attempt to set whether redirects will be followed for an HttpURLConnection .
|
void | setProperty(String propertyId, Object value)
Sets the value of a property. |
void | setScannerVersion(short version) |
void | setStandalone(boolean standalone)
Sets whether the document entity is standalone.
|
String | setupCurrentEntity(String name, XMLInputSource xmlInputSource, boolean literal, boolean isExternal)
This method uses the passed-in XMLInputSource to make
fCurrentEntity usable for reading. |
void | startDocumentEntity(XMLInputSource xmlInputSource)
Starts the document entity. |
void | startDTDEntity(XMLInputSource xmlInputSource)
Starts the DTD entity. |
void | startEntity(String entityName, boolean literal)
Starts a named entity.
|
void | startEntity(String name, XMLInputSource xmlInputSource, boolean literal, boolean isExternal)
Starts an entity.
|
void | startExternalSubset() |
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.
Parameters: uri the URI to absolutize
Note: This method ignores subsequent entity declarations.
Note: The name should be a unique symbol. The SymbolTable can be used for this purpose.
Parameters: 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.
See Also: SymbolTable
Note: This method ignores subsequent entity declarations.
Note: The name should be a unique symbol. The SymbolTable can be used for this purpose.
Parameters: name The name of the entity. text The text of the entity.
See Also: SymbolTable
Note: This method ignores subsequent entity declarations.
Note: The name should be a unique symbol. The SymbolTable can be used for this purpose.
Parameters: 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.
See Also: SymbolTable
Parameters: 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.
Returns: Returns a reader.
Parameters: systemId The systemId to be expanded.
Returns: Returns the URI string representing the expanded system identifier. A null value indicates that the given system identifier is already expanded.
Parameters: str The string to fix.
Returns: Returns the fixed URI string.
Parameters: b4 The first four bytes of the input. count The number of bytes actually read.
Returns: a 2-element array: the first element, an IANA-encoding string, the second element a Boolean which is true iff the document is big endian, false if it's little-endian, and null if the distinction isn't relevant.
Parameters: featureId The feature identifier.
Since: Xerces 2.2.0
Parameters: propertyId The property identifier.
Since: Xerces 2.2.0
Parameters: entityName The name of the entity to check.
Returns: True if the entity is declared, false otherwise.
Parameters: entityName The name of the entity to check.
Returns: True if the entity was declared in the external subset, false otherwise (including when the entity is not declared).
Parameters: entityName The name of the entity to check.
Returns: True if the entity is external, false otherwise (including when the entity is not declared).
Parameters: entityName The name of the entity to check.
Returns: True if the entity is unparsed, false otherwise (including when the entity is not declared).
Parameters: componentManager The component manager.
Throws: SAXException 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.
Parameters: publicId The public identifier of the entity. systemId The system identifier of the entity. baseSystemId The base system identifier of the entity. This is the system identifier of the current entity and is used to expand the system identifier when the system identifier is a relative URI.
Returns: Returns an input source that wraps the resolved entity. This method will never return null.
Throws: IOException Thrown on i/o error. XNIException Thrown by entity resolver to signal an error.
Parameters: entityHandler The new entity handler.
Note: Components should silently ignore features that do not affect the operation of the component.
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.
HttpURLConnection
.
This may fail on earlier JDKs which do not support setting this preference.Note: Components should silently ignore properties that do not affect the operation of the component.
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.
Parameters: standalone True if document entity is standalone.
Parameters: 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.
Returns: the encoding of the new entity or null if a character stream was employed
Throws: IOException if anything can't be read XNIException If any parser-specific goes wrong.
Parameters: xmlInputSource The input source of the document entity.
Throws: IOException Thrown on i/o error. XNIException Thrown by entity handler to signal an error.
Parameters: xmlInputSource The input source of the DTD entity.
Throws: IOException Thrown on i/o error. XNIException Thrown by entity handler to signal an error.
Parameters: entityName The name of the entity to start. literal True if this entity is started within a literal value.
Throws: IOException Thrown on i/o error. XNIException Thrown by entity handler to signal an error.
This method can be used to insert an application defined XML entity stream into the parsing stream.
Parameters: 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.
Throws: IOException Thrown on i/o error. XNIException Thrown by entity handler to signal an error.