org.apache.xerces.readers
Interface XMLEntityHandler

All Known Implementing Classes:
XMLParser

public interface XMLEntityHandler

This is the interface used for entity management. This interface is typically implemented by the "parser" class to provide entity management services for the scanner classes.

Version:
 

Inner Class Summary
static interface XMLEntityHandler.CharBuffer
          This interface is used to store and retrieve character sequences.
static interface XMLEntityHandler.EntityReader
          This is the interface for scanners to process input data from entities without needing to know the details of the underlying storage of those entities, or their encodings.
 
Field Summary
static int ATTVALUE_RESULT_COMPLEX
          Special return values for scanAttValue method.
static int ATTVALUE_RESULT_INVALID_CHAR
          Special return values for scanAttValue method.
static int ATTVALUE_RESULT_LESSTHAN
          Special return values for scanAttValue method.
static int CHARREF_RESULT_INVALID_CHAR
          Special return values for scanCharRef method.
static int CHARREF_RESULT_OUT_OF_RANGE
          Special return values for scanCharRef method.
static int CHARREF_RESULT_SEMICOLON_REQUIRED
          Special return values for scanCharRef method.
static int CONTENT_RESULT_END_OF_CDSECT
          Return values for the scanContent method.
static int CONTENT_RESULT_INVALID_CHAR
          Return values for the scanContent method.
static int CONTENT_RESULT_MARKUP_END_OF_INPUT
          Return values for the scanContent method.
static int CONTENT_RESULT_MARKUP_NOT_RECOGNIZED
          Return values for the scanContent method.
static int CONTENT_RESULT_MATCHING_ETAG
          Return values for the scanContent method.
static int CONTENT_RESULT_REFERENCE_END_OF_INPUT
          Return values for the scanContent method.
static int CONTENT_RESULT_START_OF_CDSECT
          Return values for the scanContent method.
static int CONTENT_RESULT_START_OF_CHARREF
          Return values for the scanContent method.
static int CONTENT_RESULT_START_OF_COMMENT
          Return values for the scanContent method.
static int CONTENT_RESULT_START_OF_ELEMENT
          Return values for the scanContent method.
static int CONTENT_RESULT_START_OF_ENTITYREF
          Return values for the scanContent method.
static int CONTENT_RESULT_START_OF_ETAG
          Return values for the scanContent method.
static int CONTENT_RESULT_START_OF_PI
          Return values for the scanContent method.
static int CONTEXT_DOCUMENT
          This is an enumeration of all the defined contexts in which an entity reference may appear.
static int CONTEXT_EXTERNAL_SUBSET
          This is an enumeration of all the defined contexts in which an entity reference may appear.
static int CONTEXT_IN_ATTVALUE
          This is an enumeration of all the defined contexts in which an entity reference may appear.
static int CONTEXT_IN_CONTENT
          This is an enumeration of all the defined contexts in which an entity reference may appear.
static int CONTEXT_IN_DEFAULTATTVALUE
          This is an enumeration of all the defined contexts in which an entity reference may appear.
static int CONTEXT_IN_DTD_AS_MARKUP
          This is an enumeration of all the defined contexts in which an entity reference may appear.
static int CONTEXT_IN_DTD_WITHIN_MARKUP
          This is an enumeration of all the defined contexts in which an entity reference may appear.
static int CONTEXT_IN_ENTITYVALUE
          This is an enumeration of all the defined contexts in which an entity reference may appear.
static int ENTITYTYPE_DOCUMENT
          This is an enumeration of all the defined entity types.
static int ENTITYTYPE_EXTERNAL
          This is an enumeration of all the defined entity types.
static int ENTITYTYPE_EXTERNAL_PE
          This is an enumeration of all the defined entity types.
static int ENTITYTYPE_EXTERNAL_SUBSET
          This is an enumeration of all the defined entity types.
static int ENTITYTYPE_INTERNAL
          This is an enumeration of all the defined entity types.
static int ENTITYTYPE_INTERNAL_PE
          This is an enumeration of all the defined entity types.
static int ENTITYTYPE_UNPARSED
          This is an enumeration of all the defined entity types.
static int ENTITYVALUE_RESULT_END_OF_INPUT
          Special return values for scanEntityValue method.
static int ENTITYVALUE_RESULT_FINISHED
          Special return values for scanEntityValue method.
static int ENTITYVALUE_RESULT_INVALID_CHAR
          Special return values for scanEntityValue method.
static int ENTITYVALUE_RESULT_PEREF
          Special return values for scanEntityValue method.
static int ENTITYVALUE_RESULT_REFERENCE
          Special return values for scanEntityValue method.
static int STRINGLIT_RESULT_INVALID_CHAR
          Special return values for scanStringLiteral method.
static int STRINGLIT_RESULT_QUOTE_REQUIRED
          Special return values for scanStringLiteral method.
 
Method Summary
 XMLEntityHandler.EntityReader changeReaders()
          This method is called by the reader subclasses at the end of input.
 void endEntityDecl()
          End the scope of an entity declaration.
 java.lang.String expandSystemId(java.lang.String systemId)
          Expand the system identifier relative to the entity that we are processing.
 XMLEntityHandler.EntityReader getEntityReader()
          Return the current reader.
 java.lang.String getPublicId()
          Return the public identifier of the entity that we are processing.
 int getReaderDepth()
          Return the depth set for the current reader.
 int getReaderId()
          Return a unique identifier for the current reader.
 java.lang.String getSystemId()
          Return the system identifier of the entity that we are processing.
 void processCharacters(char[] chars, int offset, int length)
          Process character data, character array version
 void processCharacters(int stringHandle)
          Process character data, StringPool handle version
 void processWhitespace(char[] chars, int offset, int length)
          Process white space data, character array version
 void processWhitespace(int stringHandle)
          Process white space data, StringPool handle version
 void setReaderDepth(int depth)
          Set the depth for the current reader.
 boolean startEntityDecl(boolean isPE, int entityName)
          Start the scope of an entity declaration.
 boolean startReadingFromDocument(InputSource source)
          Start reading from source.
 boolean startReadingFromEntity(int entityName, int readerDepth, int context)
          Start reading from this entity.
 void startReadingFromExternalSubset(java.lang.String publicId, java.lang.String systemId, int readerDepth)
          Start reading from the external subset of the DTD.
 void stopReadingFromExternalSubset()
          Finished reading from the external subset of the DTD.
 

Field Detail

CHARREF_RESULT_SEMICOLON_REQUIRED

public static final int CHARREF_RESULT_SEMICOLON_REQUIRED
Special return values for scanCharRef method. The normal return value is a unicode character. These error conditions are defined using invalid XML unicode code points.

CHARREF_RESULT_INVALID_CHAR

public static final int CHARREF_RESULT_INVALID_CHAR
Special return values for scanCharRef method. The normal return value is a unicode character. These error conditions are defined using invalid XML unicode code points.

CHARREF_RESULT_OUT_OF_RANGE

public static final int CHARREF_RESULT_OUT_OF_RANGE
Special return values for scanCharRef method. The normal return value is a unicode character. These error conditions are defined using invalid XML unicode code points.

STRINGLIT_RESULT_QUOTE_REQUIRED

public static final int STRINGLIT_RESULT_QUOTE_REQUIRED
Special return values for scanStringLiteral method. The normal return value is a StringPool handle. These error conditions are defined using invalid indices.

STRINGLIT_RESULT_INVALID_CHAR

public static final int STRINGLIT_RESULT_INVALID_CHAR
Special return values for scanStringLiteral method. The normal return value is a StringPool handle. These error conditions are defined using invalid indices.

ATTVALUE_RESULT_COMPLEX

public static final int ATTVALUE_RESULT_COMPLEX
Special return values for scanAttValue method. The normal return value is a StringPool handle for a simple AttValue that was already correctly normalized for CDATA in the original document. These other return values either indicate an error or that the AttValue needs further processing.

ATTVALUE_RESULT_LESSTHAN

public static final int ATTVALUE_RESULT_LESSTHAN
Special return values for scanAttValue method. The normal return value is a StringPool handle for a simple AttValue that was already correctly normalized for CDATA in the original document. These other return values either indicate an error or that the AttValue needs further processing.

ATTVALUE_RESULT_INVALID_CHAR

public static final int ATTVALUE_RESULT_INVALID_CHAR
Special return values for scanAttValue method. The normal return value is a StringPool handle for a simple AttValue that was already correctly normalized for CDATA in the original document. These other return values either indicate an error or that the AttValue needs further processing.

ENTITYVALUE_RESULT_FINISHED

public static final int ENTITYVALUE_RESULT_FINISHED
Special return values for scanEntityValue method. The normal return value is a StringPool handle for a simple EntityValue that was entirely contained within the original document. These other return values can either indicate an error or that the EntityValue needs further processing.

ENTITYVALUE_RESULT_REFERENCE

public static final int ENTITYVALUE_RESULT_REFERENCE
Special return values for scanEntityValue method. The normal return value is a StringPool handle for a simple EntityValue that was entirely contained within the original document. These other return values can either indicate an error or that the EntityValue needs further processing.

ENTITYVALUE_RESULT_PEREF

public static final int ENTITYVALUE_RESULT_PEREF
Special return values for scanEntityValue method. The normal return value is a StringPool handle for a simple EntityValue that was entirely contained within the original document. These other return values can either indicate an error or that the EntityValue needs further processing.

ENTITYVALUE_RESULT_INVALID_CHAR

public static final int ENTITYVALUE_RESULT_INVALID_CHAR
Special return values for scanEntityValue method. The normal return value is a StringPool handle for a simple EntityValue that was entirely contained within the original document. These other return values can either indicate an error or that the EntityValue needs further processing.

ENTITYVALUE_RESULT_END_OF_INPUT

public static final int ENTITYVALUE_RESULT_END_OF_INPUT
Special return values for scanEntityValue method. The normal return value is a StringPool handle for a simple EntityValue that was entirely contained within the original document. These other return values can either indicate an error or that the EntityValue needs further processing.

CONTENT_RESULT_START_OF_PI

public static final int CONTENT_RESULT_START_OF_PI
Return values for the scanContent method.

CONTENT_RESULT_START_OF_COMMENT

public static final int CONTENT_RESULT_START_OF_COMMENT
Return values for the scanContent method.

CONTENT_RESULT_START_OF_CDSECT

public static final int CONTENT_RESULT_START_OF_CDSECT
Return values for the scanContent method.

CONTENT_RESULT_END_OF_CDSECT

public static final int CONTENT_RESULT_END_OF_CDSECT
Return values for the scanContent method.

CONTENT_RESULT_START_OF_ETAG

public static final int CONTENT_RESULT_START_OF_ETAG
Return values for the scanContent method.

CONTENT_RESULT_MATCHING_ETAG

public static final int CONTENT_RESULT_MATCHING_ETAG
Return values for the scanContent method.

CONTENT_RESULT_START_OF_ELEMENT

public static final int CONTENT_RESULT_START_OF_ELEMENT
Return values for the scanContent method.

CONTENT_RESULT_START_OF_CHARREF

public static final int CONTENT_RESULT_START_OF_CHARREF
Return values for the scanContent method.

CONTENT_RESULT_START_OF_ENTITYREF

public static final int CONTENT_RESULT_START_OF_ENTITYREF
Return values for the scanContent method.

CONTENT_RESULT_INVALID_CHAR

public static final int CONTENT_RESULT_INVALID_CHAR
Return values for the scanContent method.

CONTENT_RESULT_MARKUP_NOT_RECOGNIZED

public static final int CONTENT_RESULT_MARKUP_NOT_RECOGNIZED
Return values for the scanContent method.

CONTENT_RESULT_MARKUP_END_OF_INPUT

public static final int CONTENT_RESULT_MARKUP_END_OF_INPUT
Return values for the scanContent method.

CONTENT_RESULT_REFERENCE_END_OF_INPUT

public static final int CONTENT_RESULT_REFERENCE_END_OF_INPUT
Return values for the scanContent method.

ENTITYTYPE_INTERNAL_PE

public static final int ENTITYTYPE_INTERNAL_PE
This is an enumeration of all the defined entity types. These are provided to communicate state information to the clients of the parser.

ENTITYTYPE_EXTERNAL_PE

public static final int ENTITYTYPE_EXTERNAL_PE
This is an enumeration of all the defined entity types. These are provided to communicate state information to the clients of the parser.

ENTITYTYPE_INTERNAL

public static final int ENTITYTYPE_INTERNAL
This is an enumeration of all the defined entity types. These are provided to communicate state information to the clients of the parser.

ENTITYTYPE_EXTERNAL

public static final int ENTITYTYPE_EXTERNAL
This is an enumeration of all the defined entity types. These are provided to communicate state information to the clients of the parser.

ENTITYTYPE_UNPARSED

public static final int ENTITYTYPE_UNPARSED
This is an enumeration of all the defined entity types. These are provided to communicate state information to the clients of the parser.

ENTITYTYPE_DOCUMENT

public static final int ENTITYTYPE_DOCUMENT
This is an enumeration of all the defined entity types. These are provided to communicate state information to the clients of the parser.

ENTITYTYPE_EXTERNAL_SUBSET

public static final int ENTITYTYPE_EXTERNAL_SUBSET
This is an enumeration of all the defined entity types. These are provided to communicate state information to the clients of the parser.

CONTEXT_IN_ATTVALUE

public static final int CONTEXT_IN_ATTVALUE
This is an enumeration of all the defined contexts in which an entity reference may appear. The order is important, as all explicit general entity references must appear first and the last of these must be CONTEXT_IN_CONTENT. This permits the test "(context <= CONTEXT_IN_CONTENT)" to be used as a quick check for a general entity reference.
See Also:
startReadingFromEntity(int, int, int)

CONTEXT_IN_DEFAULTATTVALUE

public static final int CONTEXT_IN_DEFAULTATTVALUE
This is an enumeration of all the defined contexts in which an entity reference may appear. The order is important, as all explicit general entity references must appear first and the last of these must be CONTEXT_IN_CONTENT. This permits the test "(context <= CONTEXT_IN_CONTENT)" to be used as a quick check for a general entity reference.
See Also:
startReadingFromEntity(int, int, int)

CONTEXT_IN_CONTENT

public static final int CONTEXT_IN_CONTENT
This is an enumeration of all the defined contexts in which an entity reference may appear. The order is important, as all explicit general entity references must appear first and the last of these must be CONTEXT_IN_CONTENT. This permits the test "(context <= CONTEXT_IN_CONTENT)" to be used as a quick check for a general entity reference.
See Also:
startReadingFromEntity(int, int, int)

CONTEXT_IN_DTD_AS_MARKUP

public static final int CONTEXT_IN_DTD_AS_MARKUP
This is an enumeration of all the defined contexts in which an entity reference may appear. The order is important, as all explicit general entity references must appear first and the last of these must be CONTEXT_IN_CONTENT. This permits the test "(context <= CONTEXT_IN_CONTENT)" to be used as a quick check for a general entity reference.
See Also:
startReadingFromEntity(int, int, int)

CONTEXT_IN_ENTITYVALUE

public static final int CONTEXT_IN_ENTITYVALUE
This is an enumeration of all the defined contexts in which an entity reference may appear. The order is important, as all explicit general entity references must appear first and the last of these must be CONTEXT_IN_CONTENT. This permits the test "(context <= CONTEXT_IN_CONTENT)" to be used as a quick check for a general entity reference.
See Also:
startReadingFromEntity(int, int, int)

CONTEXT_IN_DTD_WITHIN_MARKUP

public static final int CONTEXT_IN_DTD_WITHIN_MARKUP
This is an enumeration of all the defined contexts in which an entity reference may appear. The order is important, as all explicit general entity references must appear first and the last of these must be CONTEXT_IN_CONTENT. This permits the test "(context <= CONTEXT_IN_CONTENT)" to be used as a quick check for a general entity reference.
See Also:
startReadingFromEntity(int, int, int)

CONTEXT_DOCUMENT

public static final int CONTEXT_DOCUMENT
This is an enumeration of all the defined contexts in which an entity reference may appear. The order is important, as all explicit general entity references must appear first and the last of these must be CONTEXT_IN_CONTENT. This permits the test "(context <= CONTEXT_IN_CONTENT)" to be used as a quick check for a general entity reference.
See Also:
startReadingFromEntity(int, int, int)

CONTEXT_EXTERNAL_SUBSET

public static final int CONTEXT_EXTERNAL_SUBSET
This is an enumeration of all the defined contexts in which an entity reference may appear. The order is important, as all explicit general entity references must appear first and the last of these must be CONTEXT_IN_CONTENT. This permits the test "(context <= CONTEXT_IN_CONTENT)" to be used as a quick check for a general entity reference.
See Also:
startReadingFromEntity(int, int, int)
Method Detail

startReadingFromDocument

public boolean startReadingFromDocument(InputSource source)
                                 throws java.lang.Exception
Start reading from source.
Parameters:
source - The input source for the document to process.
Returns:
true if we were able to open the document source; false otherwise.
Throws:
java.lang.Exception -  

startReadingFromEntity

public boolean startReadingFromEntity(int entityName,
                                      int readerDepth,
                                      int context)
                               throws java.lang.Exception
Start reading from this entity. Note that the reader depth is not used by the reader, but is made available so that it may be retrieved at end of input to test that gramatical structures are properly nested within entities.
Parameters:
entityName - The entity name handle in the string pool.
readerDepth - The depth to associate with the reader for this entity.
context - The context of the entity reference; see CONTEXT_IN_*.
Returns:
true if the entity might start with a TextDecl; false otherwise.
Throws:
java.lang.Exception -  

startReadingFromExternalSubset

public void startReadingFromExternalSubset(java.lang.String publicId,
                                           java.lang.String systemId,
                                           int readerDepth)
                                    throws java.lang.Exception
Start reading from the external subset of the DTD.
Parameters:
publicId - The public identifier for the external subset.
systemId - The system identifier for the external subset.
readerDepth - The depth to associate with the reader for the external subset.
Throws:
java.lang.Exception -  

stopReadingFromExternalSubset

public void stopReadingFromExternalSubset()
                                   throws java.lang.Exception
Finished reading from the external subset of the DTD.
Throws:
java.lang.Exception -  

startEntityDecl

public boolean startEntityDecl(boolean isPE,
                               int entityName)
                        throws java.lang.Exception
Start the scope of an entity declaration.
Returns:
true on success; otherwise false if the entity declaration is recursive.
Throws:
java.lang.Exception -  

endEntityDecl

public void endEntityDecl()
                   throws java.lang.Exception
End the scope of an entity declaration.
Throws:
java.lang.Exception -  

getPublicId

public java.lang.String getPublicId()
Return the public identifier of the entity that we are processing.
Returns:
The public identifier, or null if not provided.

getSystemId

public java.lang.String getSystemId()
Return the system identifier of the entity that we are processing.
Returns:
The system identifier, or null if not provided.

expandSystemId

public java.lang.String expandSystemId(java.lang.String systemId)
Expand the system identifier relative to the entity that we are processing.
Returns:
The expanded system identifier.

processCharacters

public void processCharacters(char[] chars,
                              int offset,
                              int length)
                       throws java.lang.Exception
Process character data, character array version
Parameters:
chars - character buffer to be processed
offset - offset in buffer where the data starts
length - length of characters to be processed
Throws:
java.lang.Exception -  

processCharacters

public void processCharacters(int stringHandle)
                       throws java.lang.Exception
Process character data, StringPool handle version
Parameters:
stringHandle - StringPool handle to the character data
Throws:
java.lang.Exception -  

processWhitespace

public void processWhitespace(char[] chars,
                              int offset,
                              int length)
                       throws java.lang.Exception
Process white space data, character array version
Parameters:
chars - character buffer to be processed
offset - offset in buffer where the data starts
length - length of whitespace to be processed
Throws:
java.lang.Exception -  

processWhitespace

public void processWhitespace(int stringHandle)
                       throws java.lang.Exception
Process white space data, StringPool handle version
Parameters:
stringHandle - StringPool handle to the whitespace
Throws:
java.lang.Exception -  

getReaderId

public int getReaderId()
Return a unique identifier for the current reader.

setReaderDepth

public void setReaderDepth(int depth)
Set the depth for the current reader.

getReaderDepth

public int getReaderDepth()
Return the depth set for the current reader.

getEntityReader

public XMLEntityHandler.EntityReader getEntityReader()
Return the current reader.

changeReaders

public XMLEntityHandler.EntityReader changeReaders()
                                            throws java.lang.Exception
This method is called by the reader subclasses at the end of input.
Returns:
The reader to use next.
Throws:
java.lang.Exception -  


Copyright © 1999 Apache XML Project. All Rights Reserved.