org.apache.xerces.validators.dtd
Class DTDValidator

java.lang.Object
  |
  +--org.apache.xerces.validators.dtd.DTDValidator

public final class DTDValidator
extends java.lang.Object
implements XMLValidator, XMLDTDScanner.EventHandler, NamespacesScope.NamespacesHandler


Inner Class Summary
static interface DTDValidator.EventHandler
           
 
Inner classes inherited from class org.apache.xerces.framework.XMLValidator
XMLValidator.ContentSpec
 
Field Summary
protected  StringPool fStringPool
           
protected  boolean fValidating
           
 
Constructor Summary
DTDValidator(DTDValidator.EventHandler eventHandler, StringPool stringPool, XMLErrorReporter errorReporter, XMLEntityHandler entityHandler)
           
 
Method Summary
 int addAttDef(int elementIndex, int attName, int attType, int enumeration, int attDefaultType, int attDefaultValue)
          Add an attribute definition
 int addContentSpecNode(int nodeType, int nodeValue)
          Create an XMLContentSpecNode for a single non-leaf
 int addContentSpecNode(int nodeType, int nodeValue, int otherNodeValue)
          Create an XMLContentSpecNode for a two child leaf
 int addElementDecl(int elementType)
          Add an element declaration (forward reference)
 int addElementDecl(int elementType, int contentSpecType, int contentSpec)
          Add an element declaration
 int addExternalEntityDecl(int name, int publicId, int systemId)
          Add a declaration for an entity
 int addExternalPEDecl(int name, int publicId, int systemId)
          Add a declaration for an external parameter entity
protected  boolean addId(int idIndex)
           
protected  void addIdRef(int idIndex)
           
 int addInternalEntityDecl(int name, int value, int location)
          Add a declaration for an internal entity
 int addInternalPEDecl(int name, int value, int location)
          Add a declaration for an internal parameter entity
 void addNameToEnumeration(int enumHandle, int elementType, int attrName, int nameIndex, boolean isNotationType)
          Add a name to an enumeration
 int addNotationDecl(int notationName, int publicId, int systemId)
          Add a declaration for a notation
 int addUniqueLeafNode(int nodeValue)
          create an XMLContentSpecNode for a leaf
 int addUnparsedEntityDecl(int name, int publicId, int systemId, int notationName)
          Add a declaration for an unparsed entity
 boolean attributeSpecified(int elementType, XMLAttrList attrList, int attrName, Locator attrNameLocator, int attValue)
          add an attribute definition for an attribute name attrName to the element elementType.
 void callComment(int comment)
          Called when a comment has been scanned
 void callProcessingInstruction(int target, int data)
          Called when a processing instruction has been scanned
 void characters(char[] chars, int offset, int length)
          a callback for character data - String object version
 void characters(int stringIndex)
          a callback for character data - string pool version
 int checkContent(int elementIndex, int childCount, int[] children)
          Check that the content of an element is valid.
 int checkForAttributeNameWithPEReference(XMLEntityHandler.EntityReader entityReader, char fastchar)
          Scan for an attribute name at a point in the grammar where parameter entity references are allowed.
 int checkForElementTypeWithPEReference(XMLEntityHandler.EntityReader entityReader, char fastchar)
          Scan for an element type at a point in the grammar where parameter entity references are allowed.
 int checkForNameWithPEReference(XMLEntityHandler.EntityReader entityReader, char fastcheck)
          Scan for a Name at a point in the grammar where parameter entity references are allowed.
 int checkForNmtokenWithPEReference(XMLEntityHandler.EntityReader entityReader, char fastcheck)
          Scan for a name token at a point in the grammar where parameter entity references are allowed.
 void doctypeDecl(int rootElementType, int publicId, int systemId)
          Called when the doctype decl is scanned
 boolean endElement(int elementType)
          a callback for the end tag of an element
 void endEnumeration(int enumHandle)
          Finish processing an enumeration
 void endNamespaceDeclScope(int prefix)
          endNamespaceDeclScope is called when a namespace scope ends
 void endOfInput(int entityNameIndex, boolean moreToFollow)
           
 boolean externalReferenceInContent(int entityIndex)
          return true if entityIndex's entity is external, and it satisfies the requirements for an external entity reference within content
 java.lang.String getContentSpecAsString(int elementIndex)
          return elementIndex's content spec as a string
protected  void getContentSpecNode(int contentSpecIndex, XMLContentSpecNode csn)
           
 java.lang.String getContentSpecNodeAsString(int contentSpecIndex)
          Create a string representation of an XMLContentSpecNode tree
 boolean getDynamicValidationEnabled()
           
 int getEntityValue(int entityIndex)
          return the replacement text for entityIndex
 boolean getNamespacesEnabled()
           
 int getParameterEntityValue(int peIndex)
          return the replacement text for a parameter entity
 java.lang.String getPublicIdOfEntity(int entityIndex)
          return the public identifer for entityIndex
 java.lang.String getPublicIdOfParameterEntity(int peIndex)
          return the public identifier for a parameter entity
 java.lang.String getSystemIdOfEntity(int entityIndex)
          return the system identifier for entityIndex
 java.lang.String getSystemIdOfParameterEntity(int peIndex)
          return the system identifier for a parameter entity
 boolean getValidationEnabled()
           
 boolean getWarningOnDuplicateAttDef()
           
 boolean getWarningOnUndeclaredElements()
           
 void ignorableWhitespace(char[] chars, int offset, int length)
          a callback for ignorable whitespace - String object version
 void ignorableWhitespace(int stringIndex)
          a callback for ignorable whitespace - string pool version
 void internalSubset(int internalSubset)
          Supports DOM Level 2 internalSubset additions.
protected  boolean invalidStandaloneAttDef(int elementType, int attrName)
           
 boolean isExternalEntity(int entityIndex)
          return true if entityIndex's entity is external
 boolean isExternalParameterEntity(int peIndex)
          return true if a parameter entity is external
 boolean isUnparsedEntity(int entityIndex)
          return true if entityIndex's entity is unparsed
 int lookupEntity(int entityNameIndex)
          return a handle to an entity.
 int lookupParameterEntity(int peNameIndex)
          return a handle to a parameter entity - this handle can then be passed to other XMLEntityHandler methods on XMLValidator
 void readerChange(XMLEntityHandler.EntityReader nextReader, int nextReaderId)
           
protected  void reportRecoverableXMLError(int majorCode, int minorCode)
           
protected  void reportRecoverableXMLError(int majorCode, int minorCode, int stringIndex1)
           
protected  void reportRecoverableXMLError(int majorCode, int minorCode, int stringIndex1, int stringIndex2)
           
protected  void reportRecoverableXMLError(int majorCode, int minorCode, java.lang.String string1)
           
protected  void reportRecoverableXMLError(int majorCode, int minorCode, java.lang.String string1, java.lang.String string2)
           
protected  void reportRecoverableXMLError(int majorCode, int minorCode, java.lang.String string1, java.lang.String string2, java.lang.String string3)
           
 void reset(StringPool stringPool)
           
 void rootElementSpecified(int rootElementType)
          Check to see if the rootElement matches the root element specified by the DOCTYPE line.
 int saveCurrentLocation()
          REVISIT - does this really do anything -- can we kill it?
 int scanDefaultAttValue(int elementType, int attrName, int attType, int enumeration)
          Scan the default value for an attribute
 boolean scanDoctypeDecl(boolean standalone)
           
 int scanElementType(XMLEntityHandler.EntityReader entityReader, char fastchar)
          Scan an element type
 void setDynamicValidationEnabled(boolean flag)
           
 void setNamespacesEnabled(boolean flag)
           
 void setValidationEnabled(boolean flag)
           
 void setWarningOnDuplicateAttDef(boolean flag)
           
 void setWarningOnUndeclaredElements(boolean flag)
           
 boolean startElement(int elementType, XMLAttrList attrList)
          a callback for the start tag of an element
 int startEnumeration()
          Called when the scanner start scanning an enumeration
 void startNamespaceDeclScope(int prefix, int uri)
          startNamespaceDeclScope is called when a new namespace scope is created
 void startReadingFromExternalSubset(int publicId, int systemId)
          Called when the DTDScanner starts reading from the external subset
 void stopReadingFromExternalSubset()
          Called when the DTDScanner stop reading from the external subset
 boolean validEncName(java.lang.String encoding)
          Determine whether a string is a valid encoding name
 int validPublicId(java.lang.String publicId)
          Determine if a string is a valid public identifier
 boolean validVersionNum(java.lang.String version)
          Determine whether a string is a valid XML version number
 int valueOfReferenceInAttValue(int entityIndex)
          return the string pool index of an entity the entity must be allowed to appear in an attribute value
 int whatCanGoHere(int elementIndex, boolean fullyValid, InsertableElementsInfo info)
          Returns information about which elements can be placed at a particular point in the passed element's content model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fStringPool

protected StringPool fStringPool

fValidating

protected boolean fValidating
Constructor Detail

DTDValidator

public DTDValidator(DTDValidator.EventHandler eventHandler,
                    StringPool stringPool,
                    XMLErrorReporter errorReporter,
                    XMLEntityHandler entityHandler)
Method Detail

reset

public void reset(StringPool stringPool)
           throws java.lang.Exception

setValidationEnabled

public void setValidationEnabled(boolean flag)
                          throws java.lang.Exception

getValidationEnabled

public boolean getValidationEnabled()

setDynamicValidationEnabled

public void setDynamicValidationEnabled(boolean flag)
                                 throws java.lang.Exception

getDynamicValidationEnabled

public boolean getDynamicValidationEnabled()

setNamespacesEnabled

public void setNamespacesEnabled(boolean flag)

getNamespacesEnabled

public boolean getNamespacesEnabled()

startNamespaceDeclScope

public void startNamespaceDeclScope(int prefix,
                                    int uri)
                             throws java.lang.Exception
Description copied from interface: NamespacesScope.NamespacesHandler
startNamespaceDeclScope is called when a new namespace scope is created
Specified by:
startNamespaceDeclScope in interface NamespacesScope.NamespacesHandler
Tags copied from interface: NamespacesScope.NamespacesHandler
Parameters:
prefix - the StringPool handle of the namespace prefix being declared
uri - the StringPool handle of the namespace's URI
Throws:
java.lang.Exception -  

endNamespaceDeclScope

public void endNamespaceDeclScope(int prefix)
                           throws java.lang.Exception
Description copied from interface: NamespacesScope.NamespacesHandler
endNamespaceDeclScope is called when a namespace scope ends
Specified by:
endNamespaceDeclScope in interface NamespacesScope.NamespacesHandler
Tags copied from interface: NamespacesScope.NamespacesHandler
Parameters:
prefix - the StringPool handle of the namespace prefix going out of scope
Throws:
java.lang.Exception -  

internalSubset

public void internalSubset(int internalSubset)
Description copied from interface: XMLDTDScanner.EventHandler
Supports DOM Level 2 internalSubset additions. Called when the internal subset is completely scanned.
Specified by:
internalSubset in interface XMLDTDScanner.EventHandler

setWarningOnDuplicateAttDef

public void setWarningOnDuplicateAttDef(boolean flag)

getWarningOnDuplicateAttDef

public boolean getWarningOnDuplicateAttDef()

setWarningOnUndeclaredElements

public void setWarningOnUndeclaredElements(boolean flag)

getWarningOnUndeclaredElements

public boolean getWarningOnUndeclaredElements()

invalidStandaloneAttDef

protected boolean invalidStandaloneAttDef(int elementType,
                                          int attrName)

scanDoctypeDecl

public boolean scanDoctypeDecl(boolean standalone)
                        throws java.lang.Exception

characters

public void characters(char[] chars,
                       int offset,
                       int length)
                throws java.lang.Exception
Description copied from interface: XMLValidator
a callback for character data - String object version
Specified by:
characters in interface XMLValidator
Tags copied from interface: XMLValidator
Parameters:
chars - array containing the characters that were scanned
offset - offset in chars of characters that were scanned
length - length of characters that were scanned
Throws:
java.lang.Exception -  

characters

public void characters(int stringIndex)
                throws java.lang.Exception
Description copied from interface: XMLValidator
a callback for character data - string pool version
Specified by:
characters in interface XMLValidator
Tags copied from interface: XMLValidator
Parameters:
stringIndex - string pool index of the string that was scanned
Throws:
java.lang.Exception -  

ignorableWhitespace

public void ignorableWhitespace(char[] chars,
                                int offset,
                                int length)
                         throws java.lang.Exception
Description copied from interface: XMLValidator
a callback for ignorable whitespace - String object version
Specified by:
ignorableWhitespace in interface XMLValidator
Tags copied from interface: XMLValidator
Parameters:
chars - array containing the white space that was scanned
offset - offset in chars of the white space that was scanned
length - length of the white space that was scanned
Throws:
java.lang.Exception -  

ignorableWhitespace

public void ignorableWhitespace(int stringIndex)
                         throws java.lang.Exception
Description copied from interface: XMLValidator
a callback for ignorable whitespace - string pool version
Specified by:
ignorableWhitespace in interface XMLValidator
Tags copied from interface: XMLValidator
Parameters:
stringIndex - - string pool index of the white space that was scanned
Throws:
java.lang.Exception -  

lookupEntity

public int lookupEntity(int entityNameIndex)
Description copied from interface: XMLValidator
return a handle to an entity. This handle can then be passed to the other XMLEntityHandler methods on XMLValidator
Specified by:
lookupEntity in interface XMLValidator
Tags copied from interface: XMLValidator
Parameters:
entityName - string pool index of entity name
Returns:
entity Handle
Throws:
java.lang.Exception -  

externalReferenceInContent

public boolean externalReferenceInContent(int entityIndex)
                                   throws java.lang.Exception
Description copied from interface: XMLValidator
return true if entityIndex's entity is external, and it satisfies the requirements for an external entity reference within content
Specified by:
externalReferenceInContent in interface XMLValidator
Tags copied from interface: XMLValidator
Parameters:
entityIndex - entity handle
Returns:
true if the entity is external
Throws:
java.lang.Exception -  

valueOfReferenceInAttValue

public int valueOfReferenceInAttValue(int entityIndex)
                               throws java.lang.Exception
Description copied from interface: XMLValidator
return the string pool index of an entity the entity must be allowed to appear in an attribute value
Specified by:
valueOfReferenceInAttValue in interface XMLValidator
Tags copied from interface: XMLValidator
Parameters:
entityIndex - entity handle
Returns:
string pool index of entity valkue
Throws:
java.lang.Exception -  

isExternalEntity

public boolean isExternalEntity(int entityIndex)
Description copied from interface: XMLValidator
return true if entityIndex's entity is external
Specified by:
isExternalEntity in interface XMLValidator
Tags copied from interface: XMLValidator
Parameters:
entityIndex - entity handle
Returns:
true if entityIndex's entity is external
Throws:
java.lang.Exception -  

isUnparsedEntity

public boolean isUnparsedEntity(int entityIndex)
Description copied from interface: XMLValidator
return true if entityIndex's entity is unparsed
Specified by:
isUnparsedEntity in interface XMLValidator
Tags copied from interface: XMLValidator
Parameters:
entityIndex - entity handle
Returns:
true if entityIndex's entity is unparsed
Throws:
java.lang.Exception -  

getEntityValue

public int getEntityValue(int entityIndex)
Description copied from interface: XMLValidator
return the replacement text for entityIndex
Specified by:
getEntityValue in interface XMLValidator
Tags copied from interface: XMLValidator
Parameters:
entityIndex - entity handle
Returns:
the string pool index of entityIndex's replacement text
Throws:
java.lang.Exception -  

getPublicIdOfEntity

public java.lang.String getPublicIdOfEntity(int entityIndex)
Description copied from interface: XMLValidator
return the public identifer for entityIndex
Specified by:
getPublicIdOfEntity in interface XMLValidator
Tags copied from interface: XMLValidator
Parameters:
entityIndex - entity handle
Returns:
String containing entityIndex's public identifier
Throws:
java.lang.Exception -  

getSystemIdOfEntity

public java.lang.String getSystemIdOfEntity(int entityIndex)
Description copied from interface: XMLValidator
return the system identifier for entityIndex
Specified by:
getSystemIdOfEntity in interface XMLValidator
Tags copied from interface: XMLValidator
Parameters:
entityIndex - entity handle
Returns:
String containing entityIndex' system identifier
Throws:
java.lang.Exception -  

lookupParameterEntity

public int lookupParameterEntity(int peNameIndex)
                          throws java.lang.Exception
Description copied from interface: XMLValidator
return a handle to a parameter entity - this handle can then be passed to other XMLEntityHandler methods on XMLValidator
Specified by:
lookupParameterEntity in interface XMLValidator
Tags copied from interface: XMLValidator
Parameters:
peName - string pool index of a parameter entity name
Returns:
handle to the parameter entity named by peName
Throws:
java.lang.Exception -  

isExternalParameterEntity

public boolean isExternalParameterEntity(int peIndex)
Description copied from interface: XMLValidator
return true if a parameter entity is external
Specified by:
isExternalParameterEntity in interface XMLValidator
Tags copied from interface: XMLValidator
Parameters:
peIndex - parameter entity handle
Returns:
true if peIndex's parameter entity is external
Throws:
java.lang.Exception -  

getParameterEntityValue

public int getParameterEntityValue(int peIndex)
Description copied from interface: XMLValidator
return the replacement text for a parameter entity
Specified by:
getParameterEntityValue in interface XMLValidator
Tags copied from interface: XMLValidator
Parameters:
peIndex - parameter entity handle
Returns:
the string pool index of the replacment text for peIndex's parameter entity
Throws:
java.lang.Exception -  

getPublicIdOfParameterEntity

public java.lang.String getPublicIdOfParameterEntity(int peIndex)
Description copied from interface: XMLValidator
return the public identifier for a parameter entity
Specified by:
getPublicIdOfParameterEntity in interface XMLValidator
Tags copied from interface: XMLValidator
Parameters:
peIndex - parameter entity handle
Returns:
a String containing the public identifier for peIndex's parameter entity
Throws:
java.lang.Exception -  

getSystemIdOfParameterEntity

public java.lang.String getSystemIdOfParameterEntity(int peIndex)
Description copied from interface: XMLValidator
return the system identifier for a parameter entity
Specified by:
getSystemIdOfParameterEntity in interface XMLValidator
Tags copied from interface: XMLValidator
Parameters:
peIndex - parameter entity handle
Throws:
java.lang.Exception -  

rootElementSpecified

public void rootElementSpecified(int rootElementType)
                          throws java.lang.Exception
Description copied from interface: XMLValidator
Check to see if the rootElement matches the root element specified by the DOCTYPE line. Signal an error to the application if it does not.
Specified by:
rootElementSpecified in interface XMLValidator
Tags copied from interface: XMLValidator
Parameters:
rootElementType - StringPool handle for the rootElement
Throws:
java.lang.Exception -  

attributeSpecified

public boolean attributeSpecified(int elementType,
                                  XMLAttrList attrList,
                                  int attrName,
                                  Locator attrNameLocator,
                                  int attValue)
                           throws java.lang.Exception
Description copied from interface: XMLValidator
add an attribute definition for an attribute name attrName to the element elementType.
Specified by:
attributeSpecified in interface XMLValidator
Tags copied from interface: XMLValidator
Parameters:
elementType - the index of the element
attrList - the XMLAttrList to receive the new attribute
attrName - the string pool index of the attribute name
attrNameLocator - a SAX Locator (for error reporting)
attValue - the string pool index of the attribute value
Throws:
java.lang.Exception -  

startElement

public boolean startElement(int elementType,
                            XMLAttrList attrList)
                     throws java.lang.Exception
Description copied from interface: XMLValidator
a callback for the start tag of an element
Specified by:
startElement in interface XMLValidator
Tags copied from interface: XMLValidator
Parameters:
elementType - the index of the element
attrList - the XMLAttrList containing the attributes for the element
Returns:
true if processing element content //REVISIT
Throws:
java.lang.Exception -  

endElement

public boolean endElement(int elementType)
                   throws java.lang.Exception
Description copied from interface: XMLValidator
a callback for the end tag of an element
Specified by:
endElement in interface XMLValidator
Tags copied from interface: XMLValidator
Parameters:
elementType - the index of the element
Returns:
true if processing element content //REVISIT
Throws:
java.lang.Exception -  

checkContent

public int checkContent(int elementIndex,
                        int childCount,
                        int[] children)
                 throws java.lang.Exception
Check that the content of an element is valid.

This is the method of primary concern to the validator. This method is called upon the scanner reaching the end tag of an element. At that time, the element's children must be structurally validated, so it calls this method. The index of the element being checked (in the decl pool), is provided as well as an array of element name indexes of the children. The validator must confirm that this element can have these children in this order.

This can also be called to do 'what if' testing of content models just to see if they would be valid.

Note that the element index is an index into the element decl pool, whereas the children indexes are name indexes, i.e. into the string pool.

A value of -1 in the children array indicates a PCDATA node. All other indexes will be positive and represent child elements. The count can be zero, since some elements have the EMPTY content model and that must be confirmed.

Specified by:
checkContent in interface XMLValidator
Parameters:
elementIndex - The index within the ElementDeclPool of this element.
childCount - The number of entries in the children array.
children - The children of this element. Each integer is an index within the StringPool of the child element name. An index of -1 is used to indicate an occurrence of non-whitespace character data.
Returns:
The value -1 if fully valid, else the 0 based index of the child that first failed. If the value returned is equal to the number of children, then additional content is required to reach a valid ending state.
Throws:
java.lang.Exception - Thrown on error.

whatCanGoHere

public int whatCanGoHere(int elementIndex,
                         boolean fullyValid,
                         InsertableElementsInfo info)
                  throws java.lang.Exception
Returns information about which elements can be placed at a particular point in the passed element's content model.

Note that the incoming content model to test must be valid at least up to the insertion point. If not, then -1 will be returned and the info object will not have been filled in.

If, on return, the info.isValidEOC flag is set, then the 'insert after' elemement is a valid end of content, i.e. nothing needs to be inserted after it to make the parent element's content model valid.

Parameters:
elementIndex - The index within the ElementDeclPool of the element which is being querying.
fullyValid - Only return elements that can be inserted and still maintain the validity of subsequent elements past the insertion point (if any). If the insertion point is at the end, and this is true, then only elements that can be legal final states will be returned.
info - An object that contains the required input data for the method, and which will contain the output information if successful.
Returns:
The value -1 if fully valid, else the 0 based index of the child that first failed before the insertion point. If the value returned is equal to the number of children, then the specified children are valid but additional content is required to reach a valid ending state.
Throws:
java.lang.Exception - Thrown on error.
See Also:
InsertableElementsInfo

reportRecoverableXMLError

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

reportRecoverableXMLError

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

reportRecoverableXMLError

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

reportRecoverableXMLError

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

reportRecoverableXMLError

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

reportRecoverableXMLError

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

readerChange

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

endOfInput

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

saveCurrentLocation

public int saveCurrentLocation()
Description copied from interface: XMLDTDScanner.EventHandler
REVISIT - does this really do anything -- can we kill it?
Specified by:
saveCurrentLocation in interface XMLDTDScanner.EventHandler
Tags copied from interface: XMLDTDScanner.EventHandler
Returns:
the current location
Throws:
java.lang.Exception -  

validVersionNum

public boolean validVersionNum(java.lang.String version)
Description copied from interface: XMLDTDScanner.EventHandler
Determine whether a string is a valid XML version number
Specified by:
validVersionNum in interface XMLDTDScanner.EventHandler
Tags copied from interface: XMLDTDScanner.EventHandler
Parameters:
version - string to be checked
Returns:
true if version is a valid XML version number
Throws:
java.lang.Exception -  

validEncName

public boolean validEncName(java.lang.String encoding)
Description copied from interface: XMLDTDScanner.EventHandler
Determine whether a string is a valid encoding name
Specified by:
validEncName in interface XMLDTDScanner.EventHandler
Tags copied from interface: XMLDTDScanner.EventHandler
Parameters:
encoding - string to be checked
Returns:
true if encoding is a valid encoding name
Throws:
java.lang.Exception -  

validPublicId

public int validPublicId(java.lang.String publicId)
Description copied from interface: XMLDTDScanner.EventHandler
Determine if a string is a valid public identifier
Specified by:
validPublicId in interface XMLDTDScanner.EventHandler
Tags copied from interface: XMLDTDScanner.EventHandler
Parameters:
publicId - string to be checked
Returns:
true if publicId is a valid public identifier
Throws:
java.lang.Exception -  

doctypeDecl

public void doctypeDecl(int rootElementType,
                        int publicId,
                        int systemId)
                 throws java.lang.Exception
Description copied from interface: XMLDTDScanner.EventHandler
Called when the doctype decl is scanned
Specified by:
doctypeDecl in interface XMLDTDScanner.EventHandler
Tags copied from interface: XMLDTDScanner.EventHandler
Parameters:
rootElementType - handle of the rootElement
publicId - StringPool handle of the public id
systemId - StringPool handle of the system id
Throws:
java.lang.Exception -  

startReadingFromExternalSubset

public void startReadingFromExternalSubset(int publicId,
                                           int systemId)
                                    throws java.lang.Exception
Description copied from interface: XMLDTDScanner.EventHandler
Called when the DTDScanner starts reading from the external subset
Specified by:
startReadingFromExternalSubset in interface XMLDTDScanner.EventHandler
Tags copied from interface: XMLDTDScanner.EventHandler
Parameters:
publicId - StringPool handle of the public id
systemId - StringPool handle of the system id
Throws:
java.lang.Exception -  

stopReadingFromExternalSubset

public void stopReadingFromExternalSubset()
                                   throws java.lang.Exception
Description copied from interface: XMLDTDScanner.EventHandler
Called when the DTDScanner stop reading from the external subset
Specified by:
stopReadingFromExternalSubset in interface XMLDTDScanner.EventHandler
Tags copied from interface: XMLDTDScanner.EventHandler
Throws:
java.lang.Exception -  

addElementDecl

public int addElementDecl(int elementType)
                   throws java.lang.Exception
Description copied from interface: XMLDTDScanner.EventHandler
Add an element declaration (forward reference)
Specified by:
addElementDecl in interface XMLDTDScanner.EventHandler
Tags copied from interface: XMLDTDScanner.EventHandler
Parameters:
handle - to the name of the element being declared
Returns:
handle to the element whose declaration was added
Throws:
java.lang.Exception -  

addElementDecl

public int addElementDecl(int elementType,
                          int contentSpecType,
                          int contentSpec)
                   throws java.lang.Exception
Description copied from interface: XMLDTDScanner.EventHandler
Add an element declaration
Specified by:
addElementDecl in interface XMLDTDScanner.EventHandler
Tags copied from interface: XMLDTDScanner.EventHandler
Parameters:
handle - to the name of the element being declared
contentSpecType - handle to the type name of the content spec
ContentSpec - handle to the content spec node for the contentSpecType
Returns:
handle to the element declaration that was added
Throws:
java.lang.Exception -  

addAttDef

public int addAttDef(int elementIndex,
                     int attName,
                     int attType,
                     int enumeration,
                     int attDefaultType,
                     int attDefaultValue)
              throws java.lang.Exception
Description copied from interface: XMLDTDScanner.EventHandler
Add an attribute definition
Specified by:
addAttDef in interface XMLDTDScanner.EventHandler
Tags copied from interface: XMLDTDScanner.EventHandler
Parameters:
handle - to the element whose attribute is being declared
attName - StringPool handle to the attribute name being declared
attType - type of the attribute
enumeration - StringPool handle of the attribute's enumeration list (if any)
attDefaultType - an integer value denoting the DefaultDecl value
attDefaultValue - StringPool handle of this attribute's default value
Returns:
handle to the attribute definition
Throws:
java.lang.Exception -  

addUniqueLeafNode

public int addUniqueLeafNode(int nodeValue)
                      throws java.lang.Exception
Description copied from interface: XMLDTDScanner.EventHandler
create an XMLContentSpecNode for a leaf
Specified by:
addUniqueLeafNode in interface XMLDTDScanner.EventHandler
Tags copied from interface: XMLDTDScanner.EventHandler
Parameters:
nameIndex - StringPool handle to the name (Element) for the node
Returns:
handle to the newly create XMLContentSpecNode
Throws:
java.lang.Exception -  

addContentSpecNode

public int addContentSpecNode(int nodeType,
                              int nodeValue)
                       throws java.lang.Exception
Description copied from interface: XMLDTDScanner.EventHandler
Create an XMLContentSpecNode for a single non-leaf
Specified by:
addContentSpecNode in interface XMLDTDScanner.EventHandler
Tags copied from interface: XMLDTDScanner.EventHandler
Parameters:
nodeType - the type of XMLContentSpecNode to create - from XMLContentSpecNode.CONTENTSPECNODE_*
nodeValue - handle to an XMLContentSpecNode
Returns:
handle to the newly create XMLContentSpecNode
Throws:
java.lang.Exception -  

addContentSpecNode

public int addContentSpecNode(int nodeType,
                              int nodeValue,
                              int otherNodeValue)
                       throws java.lang.Exception
Description copied from interface: XMLDTDScanner.EventHandler
Create an XMLContentSpecNode for a two child leaf
Specified by:
addContentSpecNode in interface XMLDTDScanner.EventHandler
Tags copied from interface: XMLDTDScanner.EventHandler
Parameters:
nodeType - the type of XMLContentSpecNode to create - from XMLContentSpecNode.CONTENTSPECNODE_*
leftNodeIndex - handle to an XMLContentSpecNode
rightNodeIndex - handle to an XMLContentSpecNode
Returns:
handle to the newly create XMLContentSpecNode
Throws:
java.lang.Exception -  

addInternalPEDecl

public int addInternalPEDecl(int name,
                             int value,
                             int location)
                      throws java.lang.Exception
Description copied from interface: XMLDTDScanner.EventHandler
Add a declaration for an internal parameter entity
Specified by:
addInternalPEDecl in interface XMLDTDScanner.EventHandler
Tags copied from interface: XMLDTDScanner.EventHandler
Parameters:
name - StringPool handle of the parameter entity name
value - StringPool handle of the parameter entity value
location - location in the containing entity
Returns:
handle to the parameter entity declaration
Throws:
java.lang.Exception -  

addExternalPEDecl

public int addExternalPEDecl(int name,
                             int publicId,
                             int systemId)
                      throws java.lang.Exception
Description copied from interface: XMLDTDScanner.EventHandler
Add a declaration for an external parameter entity
Specified by:
addExternalPEDecl in interface XMLDTDScanner.EventHandler
Tags copied from interface: XMLDTDScanner.EventHandler
Parameters:
name - StringPool handle of the parameter entity name
publicId - StringPool handle of the publicId
systemId - StringPool handle of the systemId
Returns:
handle to the parameter entity declaration
Throws:
java.lang.Exception -  

addInternalEntityDecl

public int addInternalEntityDecl(int name,
                                 int value,
                                 int location)
                          throws java.lang.Exception
Description copied from interface: XMLDTDScanner.EventHandler
Add a declaration for an internal entity
Specified by:
addInternalEntityDecl in interface XMLDTDScanner.EventHandler
Tags copied from interface: XMLDTDScanner.EventHandler
Parameters:
name - StringPool handle of the entity name
value - StringPool handle of the entity value
location - location in the containing entity
Returns:
handle to the entity declaration
Throws:
java.lang.Exception -  

addExternalEntityDecl

public int addExternalEntityDecl(int name,
                                 int publicId,
                                 int systemId)
                          throws java.lang.Exception
Description copied from interface: XMLDTDScanner.EventHandler
Add a declaration for an entity
Specified by:
addExternalEntityDecl in interface XMLDTDScanner.EventHandler
Tags copied from interface: XMLDTDScanner.EventHandler
Parameters:
name - StringPool handle of the entity name
publicId - StringPool handle of the publicId
systemId - StringPool handle of the systemId
Returns:
handle to the entity declaration
Throws:
java.lang.Exception -  

addUnparsedEntityDecl

public int addUnparsedEntityDecl(int name,
                                 int publicId,
                                 int systemId,
                                 int notationName)
                          throws java.lang.Exception
Description copied from interface: XMLDTDScanner.EventHandler
Add a declaration for an unparsed entity
Specified by:
addUnparsedEntityDecl in interface XMLDTDScanner.EventHandler
Tags copied from interface: XMLDTDScanner.EventHandler
Parameters:
name - StringPool handle of the entity name
publicId - StringPool handle of the publicId
systemId - StringPool handle of the systemId
notationName - StringPool handle of the notationName
Returns:
handle to the entity declaration
Throws:
java.lang.Exception -  

startEnumeration

public int startEnumeration()
Description copied from interface: XMLDTDScanner.EventHandler
Called when the scanner start scanning an enumeration
Specified by:
startEnumeration in interface XMLDTDScanner.EventHandler
Tags copied from interface: XMLDTDScanner.EventHandler
Returns:
StringPool handle to a string list that will hold the enumeration names
Throws:
java.lang.Exception -  

addNameToEnumeration

public void addNameToEnumeration(int enumHandle,
                                 int elementType,
                                 int attrName,
                                 int nameIndex,
                                 boolean isNotationType)
Description copied from interface: XMLDTDScanner.EventHandler
Add a name to an enumeration
Specified by:
addNameToEnumeration in interface XMLDTDScanner.EventHandler
Tags copied from interface: XMLDTDScanner.EventHandler
Parameters:
enumIndex - StringPool handle to the string list for the enumeration
elementType - handle to the element that owns the attribute with the enumeration
attrName - StringPool handle to the name of the attribut with the enumeration
nameIndex - StringPool handle to the name to be added to the enumeration
isNotationType - true if the enumeration is an enumeration of NOTATION names
Throws:
java.lang.Exception -  

endEnumeration

public void endEnumeration(int enumHandle)
Description copied from interface: XMLDTDScanner.EventHandler
Finish processing an enumeration
Specified by:
endEnumeration in interface XMLDTDScanner.EventHandler
Tags copied from interface: XMLDTDScanner.EventHandler
Parameters:
enumIndex - handle to the string list which holds the enumeration to be finshed.
Throws:
java.lang.Exception -  

addNotationDecl

public int addNotationDecl(int notationName,
                           int publicId,
                           int systemId)
                    throws java.lang.Exception
Description copied from interface: XMLDTDScanner.EventHandler
Add a declaration for a notation
Specified by:
addNotationDecl in interface XMLDTDScanner.EventHandler
Tags copied from interface: XMLDTDScanner.EventHandler
Parameters:
notationName -  
publicId -  
systemId -  
Returns:
handle to the notation declaration
Throws:
java.lang.Exception -  

callProcessingInstruction

public void callProcessingInstruction(int target,
                                      int data)
                               throws java.lang.Exception
Description copied from interface: XMLDTDScanner.EventHandler
Called when a processing instruction has been scanned
Specified by:
callProcessingInstruction in interface XMLDTDScanner.EventHandler
Tags copied from interface: XMLDTDScanner.EventHandler
Parameters:
piTarget - StringPool handle of the PI target
piData - StringPool handle of the PI data
Throws:
java.lang.Exception -  

callComment

public void callComment(int comment)
                 throws java.lang.Exception
Description copied from interface: XMLDTDScanner.EventHandler
Called when a comment has been scanned
Specified by:
callComment in interface XMLDTDScanner.EventHandler
Tags copied from interface: XMLDTDScanner.EventHandler
Parameters:
data - StringPool handle of the comment text
Throws:
java.lang.Exception -  

scanElementType

public int scanElementType(XMLEntityHandler.EntityReader entityReader,
                           char fastchar)
                    throws java.lang.Exception
Description copied from interface: XMLDTDScanner.EventHandler
Scan an element type
Specified by:
scanElementType in interface XMLDTDScanner.EventHandler
Tags copied from interface: XMLDTDScanner.EventHandler
Parameters:
entityReader - reader to read from
fastchar - hint - character likely to terminate the element type
Returns:
StringPool handle for the element type
Throws:
java.lang.Exception -  

checkForElementTypeWithPEReference

public int checkForElementTypeWithPEReference(XMLEntityHandler.EntityReader entityReader,
                                              char fastchar)
                                       throws java.lang.Exception
Description copied from interface: XMLDTDScanner.EventHandler
Scan for an element type at a point in the grammar where parameter entity references are allowed. If such a reference is encountered, the replacement text will be scanned, skipping any white space that may be found, expanding references in this manner until an element type is scanned, or we fail to find one.
Specified by:
checkForElementTypeWithPEReference in interface XMLDTDScanner.EventHandler
Tags copied from interface: XMLDTDScanner.EventHandler
Parameters:
entityReader - reader to read from
fastchar - hint - character likely to terminate the element type
Returns:
StringPool handle for the element type
Throws:
java.lang.Exception -  

checkForAttributeNameWithPEReference

public int checkForAttributeNameWithPEReference(XMLEntityHandler.EntityReader entityReader,
                                                char fastchar)
                                         throws java.lang.Exception
Description copied from interface: XMLDTDScanner.EventHandler
Scan for an attribute name at a point in the grammar where parameter entity references are allowed. If such a reference is encountered, the replacement text will be scanned, skipping any white space that may be found, expanding references in this manner until an attribute name is scanned, or we fail to find one.
Specified by:
checkForAttributeNameWithPEReference in interface XMLDTDScanner.EventHandler
Tags copied from interface: XMLDTDScanner.EventHandler
Parameters:
entityReader - reader to read from
fastchar - hint - character likely to terminate the attribute name
Returns:
StringPool handle for the attribute name
Throws:
java.lang.Exception -  

checkForNameWithPEReference

public int checkForNameWithPEReference(XMLEntityHandler.EntityReader entityReader,
                                       char fastcheck)
                                throws java.lang.Exception
Description copied from interface: XMLDTDScanner.EventHandler
Scan for a Name at a point in the grammar where parameter entity references are allowed. If such a reference is encountered, the replacement text will be scanned, skipping any white space that may be found, expanding references in this manner until a name is scanned, or we fail to find one.
Specified by:
checkForNameWithPEReference in interface XMLDTDScanner.EventHandler
Tags copied from interface: XMLDTDScanner.EventHandler
Parameters:
entityReader - reader to read from
fastcheck - hint - character likely to terminate the name
Returns:
StringPool handle for the name
Throws:
java.lang.Exception -  

checkForNmtokenWithPEReference

public int checkForNmtokenWithPEReference(XMLEntityHandler.EntityReader entityReader,
                                          char fastcheck)
                                   throws java.lang.Exception
Description copied from interface: XMLDTDScanner.EventHandler
Scan for a name token at a point in the grammar where parameter entity references are allowed. If such a reference is encountered, the replacement text will be scanned, skipping any white space that may be found, expanding references in this manner until a name token is scanned, or we fail to find one.
Specified by:
checkForNmtokenWithPEReference in interface XMLDTDScanner.EventHandler
Tags copied from interface: XMLDTDScanner.EventHandler
Parameters:
entityReader - reader to read from
fastcheck - hint - character likely to terminate the name token
Returns:
StringPool handle for the name token
Throws:
java.lang.Exception -  

scanDefaultAttValue

public int scanDefaultAttValue(int elementType,
                               int attrName,
                               int attType,
                               int enumeration)
                        throws java.lang.Exception
Description copied from interface: XMLDTDScanner.EventHandler
Scan the default value for an attribute
Specified by:
scanDefaultAttValue in interface XMLDTDScanner.EventHandler
Tags copied from interface: XMLDTDScanner.EventHandler
Parameters:
elementType - handle to the element type that owns the attribute
attrName - StringPool handle to the name of the attribute
attType - the attribute type
enumeration - StringPool handle to a string list containing enumeration values
Returns:
StringPool handle to the default value
Throws:
java.lang.Exception -  

getContentSpecAsString

public java.lang.String getContentSpecAsString(int elementIndex)
Description copied from interface: XMLValidator
return elementIndex's content spec as a string
Specified by:
getContentSpecAsString in interface XMLValidator
Tags copied from interface: XMLValidator
Parameters:
elementIndex - element handle
Returns:
String containing the content spec for elementIndex

getContentSpecNode

protected void getContentSpecNode(int contentSpecIndex,
                                  XMLContentSpecNode csn)

getContentSpecNodeAsString

public java.lang.String getContentSpecNodeAsString(int contentSpecIndex)
Description copied from interface: XMLDTDScanner.EventHandler
Create a string representation of an XMLContentSpecNode tree
Specified by:
getContentSpecNodeAsString in interface XMLDTDScanner.EventHandler
Tags copied from interface: XMLDTDScanner.EventHandler
Parameters:
handle - to an XMLContentSpecNode
Returns:
String representation of the content spec tree
Throws:
java.lang.Exception -  

addId

protected boolean addId(int idIndex)

addIdRef

protected void addIdRef(int idIndex)


Copyright © 1999 Apache XML Project. All Rights Reserved.