|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.xerces.validators.schema.XSchemaValidator
XSchemaValidator is an experimental implementation of a validator for the W3C Schema Language. All of its implementation is subject to change.
Inner classes inherited from class org.apache.xerces.framework.XMLValidator |
XMLValidator.ContentSpec |
Constructor Summary | |
XSchemaValidator(StringPool stringPool,
XMLErrorReporter errorReporter,
XMLEntityHandler entityHandler)
|
Method Summary | |
protected void |
addRequiredNotation(int notationName,
Locator locator,
int majorCode,
int minorCode,
java.lang.Object[] args)
|
boolean |
attributeSpecified(int elementTypeIndex,
XMLAttrList attrList,
int attrNameIndex,
Locator attrNameLocator,
int attValueIndex)
add an attribute definition for an attribute name attrName to the element elementType. |
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. |
void |
checkIDRefNames()
Check that all ID references were to ID attributes present in the document. |
boolean |
endElement(int elementTypeIndex)
a callback for the end tag of an element |
boolean |
externalReferenceInContent(int entityIndex)
return true if entityIndex's entity is external, and it satisfies the requirements for an external entity reference within content |
int |
getAttName(int attDefIndex)
|
int |
getAttValue(int attDefIndex)
|
XMLContentModel |
getContentModel(int elementIndex)
|
int |
getContentSpec(int elementIndex)
|
java.lang.String |
getContentSpecAsString(int elementIndex)
return elementIndex's content spec as a string |
void |
getContentSpecNode(int contentSpecIndex,
XMLContentSpecNode csn)
|
int |
getContentSpecType(int elementIndex)
|
boolean |
getDynamicValidationEnabled()
|
int |
getElement(int elementTypeIndex)
|
int |
getElementType(int elementIndex)
|
int |
getEntityName(int entityIndex)
|
int |
getEntityValue(int entityIndex)
return the replacement text for entityIndex |
boolean |
getNamespacesEnabled()
|
int |
getNotationName(int entityIndex)
|
int |
getParameterEntityValue(int peIndex)
return the replacement text for a parameter entity |
int |
getPublicIdIndexOfEntity(int entityIndex)
|
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 |
Document |
getSchemaDocument()
Deprecated. |
int |
getSystemIdIndexOfEntity(int entityIndex)
|
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 |
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 |
void |
loadSchema(InputSource is)
|
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 |
boolean |
notationDeclared(int notationNameIndex)
|
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,
XMLErrorReporter errorReporter,
XMLEntityHandler entityHandler)
|
void |
rootElementSpecified(int rootElementType)
Check to see if the rootElement matches the root element specified by the DOCTYPE line. |
void |
setDynamicValidationEnabled(boolean flag)
|
void |
setNamespacesEnabled(boolean flag)
|
void |
setValidationEnabled(boolean flag)
|
void |
setWarningOnDuplicateAttDef(boolean flag)
|
void |
setWarningOnUndeclaredElements(boolean flag)
|
boolean |
startElement(int elementTypeIndex,
XMLAttrList attrList)
a callback for the start tag of an element |
int |
traverseDatatypeDecl(Element datatypeDecl)
|
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 |
Constructor Detail |
public XSchemaValidator(StringPool stringPool, XMLErrorReporter errorReporter, XMLEntityHandler entityHandler)
Method Detail |
public void reset(StringPool stringPool, XMLErrorReporter errorReporter, XMLEntityHandler entityHandler) throws java.lang.Exception
public Document getSchemaDocument()
public void setValidationEnabled(boolean flag)
public boolean getValidationEnabled()
public void setDynamicValidationEnabled(boolean flag)
public boolean getDynamicValidationEnabled()
public void setNamespacesEnabled(boolean flag)
public boolean getNamespacesEnabled()
public void setWarningOnDuplicateAttDef(boolean flag)
public boolean getWarningOnDuplicateAttDef()
public void setWarningOnUndeclaredElements(boolean flag)
public boolean getWarningOnUndeclaredElements()
public boolean notationDeclared(int notationNameIndex)
protected void addRequiredNotation(int notationName, Locator locator, int majorCode, int minorCode, java.lang.Object[] args) 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 getElement(int elementTypeIndex)
public int getElementType(int elementIndex) throws java.lang.Exception
public int getContentSpecType(int elementIndex)
public int getContentSpec(int elementIndex)
public java.lang.String getContentSpecAsString(int elementIndex)
elementIndex
- element handlepublic void getContentSpecNode(int contentSpecIndex, XMLContentSpecNode csn)
public int getAttName(int attDefIndex)
public int getAttValue(int attDefIndex)
public 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 getEntityName(int entityIndex)
public int getEntityValue(int entityIndex)
entityIndex
- entity handlepublic java.lang.String getPublicIdOfEntity(int entityIndex)
entityIndex
- entity handlepublic int getPublicIdIndexOfEntity(int entityIndex)
public java.lang.String getSystemIdOfEntity(int entityIndex)
entityIndex
- entity handlepublic int getSystemIdIndexOfEntity(int entityIndex)
public int getNotationName(int entityIndex)
public 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 elementTypeIndex, XMLAttrList attrList, int attrNameIndex, Locator attrNameLocator, int attValueIndex) 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 elementTypeIndex, XMLAttrList attrList) throws java.lang.Exception
elementType
- the index of the elementattrList
- the XMLAttrList containing the attributes for the elementpublic boolean endElement(int elementTypeIndex) 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 void checkIDRefNames() throws java.lang.Exception
This method is a convenience call that allows the validator to do any id ref checks above and beyond those done by the scanner. The scanner does the checks specificied in the XML spec, i.e. that ID refs refer to ids which were eventually defined somewhere in the document.
If the validator is for a Schema perhaps, which defines id semantics beyond those of the XML specificiation, this is where that extra checking would be done. For most validators, this is a no-op.
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
public XMLContentModel getContentModel(int elementIndex) throws CMException
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 loadSchema(InputSource is)
public int traverseDatatypeDecl(Element datatypeDecl) throws java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |