Overview | Package | Class | Tree | Deprecated | Index | Help
| Xerces 3.1.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.xerces.framework
Class XMLDTDScanner

    java.lang.Object
      |
      +--org.apache.xerces.framework.XMLDTDScanner

public final class XMLDTDScanner
extends java.lang.Object

Default implementation of an XML DTD scanner.

Clients who wish to scan a DTD should implement XMLDTDScanner.EventHandler to provide the desired behavior when various DTD components are encountered.

To process the DTD, the client application should follow the following sequence:

1. call scanDocTypeDecl() to scan the DOCTYPE declaration
2. call getReadingExternalEntity() to determine if scanDocTypeDecl found an external subset
3. if scanning an external subset, call scanDecls(true) to process the external subset

Version:
  $Id: XMLDTDScanner.java,v 1.15 2000/10/19 20:50:36 lehors Exp $
See Also:
  `XMLDTDScanner.EventHandler`

Inner Class Summary
`static interface` | `XMLDTDScanner.EventHandler` This interface must be implemented by the users of the XMLDTDScanner class.

Constructor Summary
`XMLDTDScanner(org.apache.xerces.utils.StringPool stringPool, XMLErrorReporter errorReporter, org.apache.xerces.readers.XMLEntityHandler entityHandler, org.apache.xerces.readers.XMLEntityHandler.CharBuffer literalData)`

Method Summary
`void` | `checkForAttributeNameWithPEReference(org.apache.xerces.readers.XMLEntityHandler.EntityReader entityReader, char fastchar, org.apache.xerces.utils.QName attribute)`
`void` | `checkForElementTypeWithPEReference(org.apache.xerces.readers.XMLEntityHandler.EntityReader entityReader, char fastchar, org.apache.xerces.utils.QName element)`
`int` | `checkForNameWithPEReference(org.apache.xerces.readers.XMLEntityHandler.EntityReader entityReader, char fastcheck)`
`int` | `checkForNmtokenWithPEReference(org.apache.xerces.readers.XMLEntityHandler.EntityReader entityReader, char fastcheck)`
`void` | `endOfInput(int entityNameIndex, boolean moreToFollow)` Handle the end of input
`boolean` | `getReadingContentSpec()` Is the scanner reading a ContentSpec?
`boolean` | `getReadingExternalEntity()` Is the XMLDTDScanner reading from an external entity? This will be true, in particular if there was an external subset
`int` | `markupDepth()` Report the markup nesting depth.
`int` | `normalizeDefaultAttValue(org.apache.xerces.utils.QName attribute, int defaultAttValue, int attType, int enumeration, boolean list)`
`int` | `parenDepth()` Report the parenthesis nesting depth.
`void` | `readerChange(org.apache.xerces.readers.XMLEntityHandler.EntityReader nextReader, int nextReaderId)` Change readers
`protected void` | `reportRecoverableXMLError(int majorCode, int minorCode, int stringIndex1)` Report a recoverable xml error.
`protected void` | `reportRecoverableXMLError(int majorCode, int minorCode, java.lang.String string1)` Report a recoverable xml error.
`protected void` | `reportRecoverableXMLError(int majorCode, int minorCode, java.lang.String string1, java.lang.String string2)` Report a recoverable xml error.
`void` | `reset(org.apache.xerces.utils.StringPool stringPool, org.apache.xerces.readers.XMLEntityHandler.CharBuffer literalData)` Allow XMLDTDScanner to be reused.
`void` | `scanDecls(boolean extSubset)` Scan markup declarations
`int` | `scanDefaultAttValue(org.apache.xerces.utils.QName element, org.apache.xerces.utils.QName attribute)` Scan the default value in an attribute declaration
`int` | `scanDefaultAttValue(org.apache.xerces.utils.QName element, org.apache.xerces.utils.QName attribute, int attType, int enumeration)`
`boolean` | `scanDoctypeDecl()` This routine is called after the <!DOCTYPE portion of a DOCTYPE line has been called.
`void` | `setDTDHandler(XMLDocumentHandler.DTDHandler dtdHandler)` Set the DTD handler.
`void` | `setEventHandler(XMLDTDScanner.EventHandler eventHandler)` Set the event handler
`void` | `setGrammarResolver(org.apache.xerces.validators.common.GrammarResolver resolver)` Sets the grammar resolver.
`void` | `setNamespacesEnabled(boolean enabled)` set fNamespacesEnabled
`void` | `setValidationEnabled(boolean enabled)` set fValidationEnabled

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### XMLDTDScanner

    public XMLDTDScanner(org.apache.xerces.utils.StringPool stringPool,
                         XMLErrorReporter errorReporter,
                         org.apache.xerces.readers.XMLEntityHandler entityHandler,
                         org.apache.xerces.readers.XMLEntityHandler.CharBuffer literalData)

Method Detail

### setEventHandler

    public void setEventHandler(XMLDTDScanner.EventHandler eventHandler)

  Set the event handler
  Parameters:
    `eventHandler` - The place to send our callbacks.

### setDTDHandler

    public void setDTDHandler(XMLDocumentHandler.DTDHandler dtdHandler)

  Set the DTD handler.

### setGrammarResolver

    public void setGrammarResolver(org.apache.xerces.validators.common.GrammarResolver resolver)

  Sets the grammar resolver.

### setNamespacesEnabled

    public void setNamespacesEnabled(boolean enabled)

  set fNamespacesEnabled

### setValidationEnabled

    public void setValidationEnabled(boolean enabled)

  set fValidationEnabled

### getReadingExternalEntity

    public boolean getReadingExternalEntity()

  Is the XMLDTDScanner reading from an external entity? This will be true, in particular if there was an external subset
  Returns:
    true if the XMLDTDScanner is reading from an external entity.

### getReadingContentSpec

    public boolean getReadingContentSpec()

  Is the scanner reading a ContentSpec?
  Returns:
    true if the scanner is reading a ContentSpec

### markupDepth

    public int markupDepth()

  Report the markup nesting depth. This allows a client to perform validation checks for correct markup nesting. This keeps scanning and validation separate.
  Returns:
    the markup nesting depth

### parenDepth

    public int parenDepth()

  Report the parenthesis nesting depth. This allows a client to perform validation checks for correct parenthesis balancing. This keeps scanning and validation separate.
  Returns:
    the parenthesis depth

### reset

    public void reset(org.apache.xerces.utils.StringPool stringPool,
                      org.apache.xerces.readers.XMLEntityHandler.CharBuffer literalData)
               throws java.lang.Exception

  Allow XMLDTDScanner to be reused. This method is called from an XMLParser reset method, which passes the StringPool to be used by the reset DTD scanner instance.
  Parameters:
    `stringPool` - the string pool to be used by XMLDTDScanner.

### reportRecoverableXMLError

    protected void reportRecoverableXMLError(int majorCode,
                                             int minorCode,
                                             int stringIndex1)
                                      throws java.lang.Exception

  Report a recoverable xml error.

### reportRecoverableXMLError

    protected void reportRecoverableXMLError(int majorCode,
                                             int minorCode,
                                             java.lang.String string1)
                                      throws java.lang.Exception

  Report a recoverable xml error.

### reportRecoverableXMLError

    protected void reportRecoverableXMLError(int majorCode,
                                             int minorCode,
                                             java.lang.String string1,
                                             java.lang.String string2)
                                      throws java.lang.Exception

  Report a recoverable xml error.

### readerChange

    public void readerChange(org.apache.xerces.readers.XMLEntityHandler.EntityReader nextReader,
                             int nextReaderId)
                      throws java.lang.Exception

  Change readers
  Parameters:
    `nextReader` - the new reader that the scanner will use
    `nextReaderId` - id of the reader to change to
  Throws:
    throws - java.lang.Exception

### endOfInput

    public void endOfInput(int entityNameIndex,
                           boolean moreToFollow)
                    throws java.lang.Exception

  Handle the end of input
  Parameters:
    `entityName` - the handle in the string pool of the name of the entity which has reached end of input
    `moreToFollow` - if true, there is still input left to process in other readers
  Throws:
    java.lang.Exception -

### scanDoctypeDecl

    public boolean scanDoctypeDecl()
                            throws java.lang.Exception

  This routine is called after the <!DOCTYPE portion of a DOCTYPE line has been called. scanDocTypeDecl goes onto scan the rest of the DOCTYPE decl. If an internal DTD subset exists, it is scanned. If an external DTD subset exists, scanDocTypeDecl sets up the state necessary to process it.
  Returns:
    true if successful
  Throws:
    java.lang.Exception -

### scanDecls

    public void scanDecls(boolean extSubset)
                   throws java.lang.Exception

  Scan markup declarations
  Parameters:
    `extSubset` - true if the scanner is scanning an external subset, false if it is scanning an internal subset
  Throws:
    java.lang.Exception -

### scanDefaultAttValue

    public int scanDefaultAttValue(org.apache.xerces.utils.QName element,
                                   org.apache.xerces.utils.QName attribute)
                            throws java.lang.Exception

  Scan the default value in an attribute declaration
  Parameters:
    `elementType` - handle to the element that owns the attribute
    `attrName` - handle in the string pool for the attribute name
  Returns:
    handle in the string pool for the default attribute value
  Throws:
    java.lang.Exception -

### checkForElementTypeWithPEReference

    public void checkForElementTypeWithPEReference(org.apache.xerces.readers.XMLEntityHandler.EntityReader entityReader,
                                                   char fastchar,
                                                   org.apache.xerces.utils.QName element)
                                            throws java.lang.Exception

### checkForAttributeNameWithPEReference

    public void checkForAttributeNameWithPEReference(org.apache.xerces.readers.XMLEntityHandler.EntityReader entityReader,
                                                     char fastchar,
                                                     org.apache.xerces.utils.QName attribute)
                                              throws java.lang.Exception

### checkForNameWithPEReference

    public int checkForNameWithPEReference(org.apache.xerces.readers.XMLEntityHandler.EntityReader entityReader,
                                           char fastcheck)
                                    throws java.lang.Exception

### checkForNmtokenWithPEReference

    public int checkForNmtokenWithPEReference(org.apache.xerces.readers.XMLEntityHandler.EntityReader entityReader,
                                              char fastcheck)
                                       throws java.lang.Exception

### scanDefaultAttValue

    public int scanDefaultAttValue(org.apache.xerces.utils.QName element,
                                   org.apache.xerces.utils.QName attribute,
                                   int attType,
                                   int enumeration)
                            throws java.lang.Exception

### normalizeDefaultAttValue

    public int normalizeDefaultAttValue(org.apache.xerces.utils.QName attribute,
                                        int defaultAttValue,
                                        int attType,
                                        int enumeration,
                                        boolean list)
                                 throws java.lang.Exception

Overview | Package | Class | Tree | Deprecated | Index | Help
| Xerces 3.1.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD