|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.xerces.validators.dtd.DTDValidator
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 |
protected StringPool fStringPool
protected boolean fValidating
Constructor Detail |
public DTDValidator(DTDValidator.EventHandler eventHandler, StringPool stringPool, XMLErrorReporter errorReporter, XMLEntityHandler entityHandler)
Method Detail |
public void reset(StringPool stringPool) throws java.lang.Exception
public void setValidationEnabled(boolean flag) throws java.lang.Exception
public boolean getValidationEnabled()
public void setDynamicValidationEnabled(boolean flag) throws java.lang.Exception
public boolean getDynamicValidationEnabled()
public void setNamespacesEnabled(boolean flag)
public boolean getNamespacesEnabled()
public void startNamespaceDeclScope(int prefix, int uri) throws java.lang.Exception
prefix
- the StringPool handle of the namespace prefix being declareduri
- the StringPool handle of the namespace's URIpublic void endNamespaceDeclScope(int prefix) throws java.lang.Exception
prefix
- the StringPool handle of the namespace prefix going out of scopepublic void internalSubset(int internalSubset)
public void setWarningOnDuplicateAttDef(boolean flag)
public boolean getWarningOnDuplicateAttDef()
public void setWarningOnUndeclaredElements(boolean flag)
public boolean getWarningOnUndeclaredElements()
protected boolean invalidStandaloneAttDef(int elementType, int attrName)
public boolean scanDoctypeDecl(boolean standalone) throws java.lang.Exception
public void characters(char[] chars, int offset, int length) throws java.lang.Exception
chars
- array containing the characters that were scannedoffset
- offset in chars of characters that were scannedlength
- length of characters that were scannedpublic void characters(int stringIndex) throws java.lang.Exception
stringIndex
- string pool index of the string that was scannedpublic void ignorableWhitespace(char[] chars, int offset, int length) throws java.lang.Exception
chars
- array containing the white space that was scannedoffset
- offset in chars of the white space that was scannedlength
- length of the white space that was scannedpublic void ignorableWhitespace(int stringIndex) throws java.lang.Exception
stringIndex
- - string pool index of the white space that was scannedpublic int lookupEntity(int entityNameIndex)
entityName
- string pool index of entity namepublic boolean externalReferenceInContent(int entityIndex) throws java.lang.Exception
entityIndex
- entity handlepublic int valueOfReferenceInAttValue(int entityIndex) throws java.lang.Exception
entityIndex
- entity handlepublic boolean isExternalEntity(int entityIndex)
entityIndex
- entity handlepublic boolean isUnparsedEntity(int entityIndex)
entityIndex
- entity handlepublic int getEntityValue(int entityIndex)
entityIndex
- entity handlepublic java.lang.String getPublicIdOfEntity(int entityIndex)
entityIndex
- entity handlepublic java.lang.String getSystemIdOfEntity(int entityIndex)
entityIndex
- entity handlepublic int lookupParameterEntity(int peNameIndex) throws java.lang.Exception
peName
- string pool index of a parameter entity namepublic boolean isExternalParameterEntity(int peIndex)
peIndex
- parameter entity handlepublic int getParameterEntityValue(int peIndex)
peIndex
- parameter entity handlepublic java.lang.String getPublicIdOfParameterEntity(int peIndex)
peIndex
- parameter entity handlepublic java.lang.String getSystemIdOfParameterEntity(int peIndex)
peIndex
- parameter entity handlepublic void rootElementSpecified(int rootElementType) throws java.lang.Exception
rootElementType
- StringPool handle for the rootElementpublic boolean attributeSpecified(int elementType, XMLAttrList attrList, int attrName, Locator attrNameLocator, int attValue) throws java.lang.Exception
elementType
- the index of the elementattrList
- the XMLAttrList to receive the new attributeattrName
- the string pool index of the attribute nameattrNameLocator
- a SAX Locator (for error reporting)attValue
- the string pool index of the attribute valuepublic boolean startElement(int elementType, XMLAttrList attrList) throws java.lang.Exception
elementType
- the index of the elementattrList
- the XMLAttrList containing the attributes for the elementpublic boolean endElement(int elementType) throws java.lang.Exception
elementType
- the index of the elementpublic int checkContent(int elementIndex, int childCount, int[] children) throws java.lang.Exception
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.
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.public int whatCanGoHere(int elementIndex, boolean fullyValid, InsertableElementsInfo info) throws java.lang.Exception
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.
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.InsertableElementsInfo
protected void reportRecoverableXMLError(int majorCode, int minorCode) throws java.lang.Exception
protected void reportRecoverableXMLError(int majorCode, int minorCode, int stringIndex1) throws java.lang.Exception
protected void reportRecoverableXMLError(int majorCode, int minorCode, java.lang.String string1) throws java.lang.Exception
protected void reportRecoverableXMLError(int majorCode, int minorCode, int stringIndex1, int stringIndex2) throws java.lang.Exception
protected void reportRecoverableXMLError(int majorCode, int minorCode, java.lang.String string1, java.lang.String string2) throws java.lang.Exception
protected void reportRecoverableXMLError(int majorCode, int minorCode, java.lang.String string1, java.lang.String string2, java.lang.String string3) throws java.lang.Exception
public void readerChange(XMLEntityHandler.EntityReader nextReader, int nextReaderId) throws java.lang.Exception
public void endOfInput(int entityNameIndex, boolean moreToFollow) throws java.lang.Exception
public int saveCurrentLocation()
public boolean validVersionNum(java.lang.String version)
version
- string to be checkedpublic boolean validEncName(java.lang.String encoding)
encoding
- string to be checkedpublic int validPublicId(java.lang.String publicId)
publicId
- string to be checkedpublic void doctypeDecl(int rootElementType, int publicId, int systemId) throws java.lang.Exception
rootElementType
- handle of the rootElementpublicId
- StringPool handle of the public idsystemId
- StringPool handle of the system idpublic void startReadingFromExternalSubset(int publicId, int systemId) throws java.lang.Exception
publicId
- StringPool handle of the public idsystemId
- StringPool handle of the system idpublic void stopReadingFromExternalSubset() throws java.lang.Exception
public int addElementDecl(int elementType) throws java.lang.Exception
handle
- to the name of the element being declaredpublic int addElementDecl(int elementType, int contentSpecType, int contentSpec) throws java.lang.Exception
handle
- to the name of the element being declaredcontentSpecType
- handle to the type name of the content specContentSpec
- handle to the content spec node for the contentSpecTypepublic int addAttDef(int elementIndex, int attName, int attType, int enumeration, int attDefaultType, int attDefaultValue) throws java.lang.Exception
handle
- to the element whose attribute is being declaredattName
- StringPool handle to the attribute name being declaredattType
- type of the attributeenumeration
- StringPool handle of the attribute's enumeration list (if any)attDefaultType
- an integer value denoting the DefaultDecl valueattDefaultValue
- StringPool handle of this attribute's default valuepublic int addUniqueLeafNode(int nodeValue) throws java.lang.Exception
nameIndex
- StringPool handle to the name (Element) for the nodepublic int addContentSpecNode(int nodeType, int nodeValue) throws java.lang.Exception
nodeType
- the type of XMLContentSpecNode to create - from XMLContentSpecNode.CONTENTSPECNODE_*nodeValue
- handle to an XMLContentSpecNodepublic int addContentSpecNode(int nodeType, int nodeValue, int otherNodeValue) throws java.lang.Exception
nodeType
- the type of XMLContentSpecNode to create - from XMLContentSpecNode.CONTENTSPECNODE_*leftNodeIndex
- handle to an XMLContentSpecNoderightNodeIndex
- handle to an XMLContentSpecNodepublic int addInternalPEDecl(int name, int value, int location) throws java.lang.Exception
name
- StringPool handle of the parameter entity namevalue
- StringPool handle of the parameter entity valuelocation
- location in the containing entitypublic int addExternalPEDecl(int name, int publicId, int systemId) throws java.lang.Exception
name
- StringPool handle of the parameter entity namepublicId
- StringPool handle of the publicIdsystemId
- StringPool handle of the systemIdpublic int addInternalEntityDecl(int name, int value, int location) throws java.lang.Exception
name
- StringPool handle of the entity namevalue
- StringPool handle of the entity valuelocation
- location in the containing entitypublic int addExternalEntityDecl(int name, int publicId, int systemId) throws java.lang.Exception
name
- StringPool handle of the entity namepublicId
- StringPool handle of the publicIdsystemId
- StringPool handle of the systemIdpublic int addUnparsedEntityDecl(int name, int publicId, int systemId, int notationName) throws java.lang.Exception
name
- StringPool handle of the entity namepublicId
- StringPool handle of the publicIdsystemId
- StringPool handle of the systemIdnotationName
- StringPool handle of the notationNamepublic int startEnumeration()
public void addNameToEnumeration(int enumHandle, int elementType, int attrName, int nameIndex, boolean isNotationType)
enumIndex
- StringPool handle to the string list for the enumerationelementType
- handle to the element that owns the attribute with the enumerationattrName
- StringPool handle to the name of the attribut with the enumerationnameIndex
- StringPool handle to the name to be added to the enumerationisNotationType
- true if the enumeration is an enumeration of NOTATION namespublic void endEnumeration(int enumHandle)
enumIndex
- handle to the string list which holds the enumeration to be finshed.public int addNotationDecl(int notationName, int publicId, int systemId) throws java.lang.Exception
notationName
- publicId
- systemId
- public void callProcessingInstruction(int target, int data) throws java.lang.Exception
piTarget
- StringPool handle of the PI targetpiData
- StringPool handle of the PI datapublic void callComment(int comment) throws java.lang.Exception
data
- StringPool handle of the comment textpublic int scanElementType(XMLEntityHandler.EntityReader entityReader, char fastchar) throws java.lang.Exception
entityReader
- reader to read fromfastchar
- hint - character likely to terminate the element typepublic int checkForElementTypeWithPEReference(XMLEntityHandler.EntityReader entityReader, char fastchar) throws java.lang.Exception
entityReader
- reader to read fromfastchar
- hint - character likely to terminate the element typepublic int checkForAttributeNameWithPEReference(XMLEntityHandler.EntityReader entityReader, char fastchar) throws java.lang.Exception
entityReader
- reader to read fromfastchar
- hint - character likely to terminate the attribute namepublic int checkForNameWithPEReference(XMLEntityHandler.EntityReader entityReader, char fastcheck) throws java.lang.Exception
entityReader
- reader to read fromfastcheck
- hint - character likely to terminate the namepublic int checkForNmtokenWithPEReference(XMLEntityHandler.EntityReader entityReader, char fastcheck) throws java.lang.Exception
entityReader
- reader to read fromfastcheck
- hint - character likely to terminate the name tokenpublic int scanDefaultAttValue(int elementType, int attrName, int attType, int enumeration) throws java.lang.Exception
elementType
- handle to the element type that owns the attributeattrName
- StringPool handle to the name of the attributeattType
- the attribute typeenumeration
- StringPool handle to a string list containing enumeration valuespublic java.lang.String getContentSpecAsString(int elementIndex)
elementIndex
- element handleprotected void getContentSpecNode(int contentSpecIndex, XMLContentSpecNode csn)
public java.lang.String getContentSpecNodeAsString(int contentSpecIndex)
handle
- to an XMLContentSpecNodeprotected boolean addId(int idIndex)
protected void addIdRef(int idIndex)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |