|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.xerces.validators.common.XMLValidator
This class is the super all-in-one validator used by the parser.
Inner Class Summary | |
---|---|
static interface |
XMLValidator.AttributeValidator
AttributeValidator. |
protected class |
XMLValidator.KeyRefValueStore
Key reference value store. |
protected class |
XMLValidator.KeyValueStore
Key value store. |
protected class |
XMLValidator.UniqueValueStore
Unique value store. |
protected class |
XMLValidator.ValueStoreBase
Value store implementation base class. |
protected class |
XMLValidator.ValueStoreCache
Value store cache. |
protected static class |
XMLValidator.XPathMatcherStack
Stack of XPath matchers for identity constraints. |
Field Summary | |
---|---|
protected static boolean |
DEBUG_IDENTITY_CONSTRAINTS
Compile to true to debug identity constraints. |
protected static boolean |
DEBUG_VALUE_STORES
Compile to true to debug value stores. |
protected static java.lang.Object |
fgNullObject
|
protected XMLValidator.XPathMatcherStack |
fMatcherStack
Stack of active XPath matchers for identity constraints. |
protected SubstitutionGroupComparator |
fSGComparator
|
protected XMLValidator.ValueStoreCache |
fValueStoreCache
Cache of value stores for identity constraint fields. |
protected java.util.Hashtable |
UPACheckedGrammarURIs
|
Constructor Summary | |
---|---|
XMLValidator(StringPool stringPool,
XMLErrorReporter errorReporter,
DefaultEntityHandler entityHandler,
XMLDocumentScanner documentScanner)
Constructs an XML validator. |
Method Summary | |
---|---|
XPathMatcher |
activateField(Field field)
Request to activate the specified field. |
boolean |
attribute(QName element,
QName attrName,
int attrValue)
Signal the scanning of an attribute associated to the previous start element tag. |
void |
callCharacters(int ch)
Call characters. |
void |
callComment(int comment)
Call comment. |
void |
callEndCDATA()
Call end CDATA section. |
void |
callEndDocument()
Call end document. |
void |
callEndElement(int readerId)
Call end element. |
void |
callProcessingInstruction(int target,
int data)
Call processing instruction. |
void |
callStandaloneIsYes()
Signal standalone = "yes" |
void |
callStartCDATA()
Call start CDATA section. |
void |
callStartDocument()
Call start document. |
void |
callStartElement(QName element)
Call start element. |
void |
callTextDecl(int version,
int encoding)
Call text declaration. |
void |
callXMLDecl(int version,
int encoding,
int standalone)
Call XML declaration. |
void |
element(QName element)
Signal the scanning of an element name in a start element tag. |
void |
endEntityReference(int entityName,
int entityType,
int entityContext)
End entity reference. |
void |
endNamespaceDeclScope(int prefix)
End a namespace declaration scope. |
void |
endValueScopeFor(IdentityConstraint identityConstraint)
Ends the value scope for the specified identity constraint. |
boolean |
externalEntityStandaloneCheck()
External entity standalone check. |
protected boolean |
getAttDefIsExternal(QName element,
QName attribute)
Protected for use by AttributeValidator classes. |
int |
getContentSpecHandle(int elementIndex)
Returns the content spec handle for an element index. |
int |
getContentSpecType(int elementIndex)
Returns the content spec type for an element index. |
boolean |
getDynamicValidationEnabled()
Returns true if validation is dynamic. |
java.lang.String |
getExternalNoNamespaceSchema()
|
java.lang.String |
getExternalSchemas()
|
boolean |
getLoadDTDGrammar()
Returns fLoadDTDGrammar |
boolean |
getNamespacesEnabled()
Returns true if namespaces are enabled. |
boolean |
getNormalizeConents()
|
boolean |
getSchemaFullCheckingEnabled()
Returns true if full Schema checking is on. |
boolean |
getSchemaValidationEnabled()
Returns true if Schema support is on. |
boolean |
getValidating()
Return true if validating. |
boolean |
getValidationEnabled()
Returns true if validation is enabled. |
boolean |
getWarningOnDuplicateAttDef()
Returns true if duplicate attribute definitions signal a warning. |
boolean |
getWarningOnUndeclaredElements()
Returns true if undeclared elements signal a warning. |
void |
initHandlers(boolean sendCharDataAsCharArray,
XMLDocumentHandler docHandler,
XMLDocumentHandler.DTDHandler dtdHandler)
Set char data processing preference and handlers. |
void |
processCharacters(char[] chars,
int offset,
int length)
Process characters. |
void |
processCharacters(int data)
Process characters. |
void |
processWhitespace(char[] chars,
int offset,
int length)
Process whitespace. |
void |
processWhitespace(int data)
Process whitespace. |
protected void |
reportRecoverableXMLError(int majorCode,
int minorCode)
Report a recoverable xml error. |
protected void |
reportRecoverableXMLError(int majorCode,
int minorCode,
int stringIndex1)
Report a recoverable xml error. |
protected void |
reportRecoverableXMLError(int majorCode,
int minorCode,
int stringIndex1,
int stringIndex2)
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. |
protected void |
reportRecoverableXMLError(int majorCode,
int minorCode,
java.lang.String string1,
java.lang.String string2,
java.lang.String string3)
Report a recoverable xml error. |
void |
reset(StringPool stringPool)
Reset. |
void |
resetOrCopy(StringPool stringPool)
Reset or copy. |
void |
scanAttributeName(XMLEntityHandler.EntityReader entityReader,
QName element,
QName attribute)
Scans attribute name. |
void |
scanElementType(XMLEntityHandler.EntityReader entityReader,
char fastchar,
QName element)
Scans element type. |
boolean |
scanExpectedElementType(XMLEntityHandler.EntityReader entityReader,
char fastchar,
QName element)
Scans expected element type. |
void |
sendEndOfInputNotifications(int entityName,
boolean moreToFollow)
Send end of input notification. |
void |
sendReaderChangeNotifications(XMLEntityHandler.EntityReader reader,
int readerId)
Send reader change notifications. |
void |
setDynamicValidationEnabled(boolean flag)
Sets whether validation is dynamic. |
void |
setExternalNoNamespaceSchema(java.lang.Object value)
|
void |
setExternalSchemas(java.lang.Object value)
|
void |
setGrammarResolver(GrammarResolver grammarResolver)
|
void |
setLoadDTDGrammar(boolean loadDG)
Sets fLoadDTDGrammar when validation is off |
void |
setNamespacesEnabled(boolean flag)
Sets whether namespaces are enabled. |
void |
setNormalizeAttributeValues(boolean normalize)
Sets fNormalizeAttributeValues |
void |
setNormalizeContents(boolean normalize)
Sets fNormalizeContents |
void |
setRootElementType(QName rootElement)
Sets the root element. |
void |
setSchemaFullCheckingEnabled(boolean flag)
Sets whether full Schema error checking is on/off |
void |
setSchemaValidationEnabled(boolean flag)
Sets whether Schema support is on/off. |
void |
setValidationEnabled(boolean flag)
Turning on validation/dynamic turns on validation if it is off, and this is remembered. |
void |
setWarningOnDuplicateAttDef(boolean flag)
Sets whether duplicate attribute definitions signal a warning. |
void |
setWarningOnUndeclaredElements(boolean flag)
Sets whether undeclared elements signal a warning. |
void |
startEntityReference(int entityName,
int entityType,
int entityContext)
Start entity reference. |
void |
startNamespaceDeclScope(int prefix,
int uri)
Start a new namespace declaration scope. |
void |
startValueScopeFor(IdentityConstraint identityConstraint)
Start the value scope for the specified identity constraint. |
protected 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 static final boolean DEBUG_IDENTITY_CONSTRAINTS
protected static final boolean DEBUG_VALUE_STORES
protected XMLValidator.XPathMatcherStack fMatcherStack
For each element with identity constraints, the selector of each identity constraint is activated. When the selector matches its XPath, then all the fields of the identity constraint are activated.
Note: Once the activation scope is left, the XPath matchers are automatically removed from the stack of active matchers and no longer receive callbacks.
protected XMLValidator.ValueStoreCache fValueStoreCache
protected SubstitutionGroupComparator fSGComparator
protected java.util.Hashtable UPACheckedGrammarURIs
protected static java.lang.Object fgNullObject
Constructor Detail |
public XMLValidator(StringPool stringPool, XMLErrorReporter errorReporter, DefaultEntityHandler entityHandler, XMLDocumentScanner documentScanner)
Method Detail |
public void setGrammarResolver(GrammarResolver grammarResolver)
public void initHandlers(boolean sendCharDataAsCharArray, XMLDocumentHandler docHandler, XMLDocumentHandler.DTDHandler dtdHandler)
public void resetOrCopy(StringPool stringPool) throws java.lang.Exception
public void reset(StringPool stringPool) throws java.lang.Exception
public void setValidationEnabled(boolean flag) throws java.lang.Exception
public boolean getValidationEnabled()
public void setSchemaValidationEnabled(boolean flag)
public boolean getSchemaValidationEnabled()
public void setSchemaFullCheckingEnabled(boolean flag)
public void setExternalSchemas(java.lang.Object value)
public void setExternalNoNamespaceSchema(java.lang.Object value)
public java.lang.String getExternalSchemas()
public java.lang.String getExternalNoNamespaceSchema()
public boolean getSchemaFullCheckingEnabled()
public void setDynamicValidationEnabled(boolean flag) throws java.lang.Exception
public boolean getDynamicValidationEnabled()
public void setNormalizeAttributeValues(boolean normalize)
public void setLoadDTDGrammar(boolean loadDG)
public boolean getLoadDTDGrammar()
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 void setNormalizeContents(boolean normalize)
public boolean getNormalizeConents()
public void startValueScopeFor(IdentityConstraint identityConstraint) throws java.lang.Exception
startValueScopeFor
in interface FieldActivator
identityConstraint
- The identity constraint.public XPathMatcher activateField(Field field) throws java.lang.Exception
activateField
in interface FieldActivator
field
- The field to activate.public void endValueScopeFor(IdentityConstraint identityConstraint) throws java.lang.Exception
endValueScopeFor
in interface FieldActivator
identityConstraint
- The identity constraint.public void startEntityReference(int entityName, int entityType, int entityContext) throws java.lang.Exception
startEntityReference
in interface DefaultEntityHandler.EventHandler
public void endEntityReference(int entityName, int entityType, int entityContext) throws java.lang.Exception
endEntityReference
in interface DefaultEntityHandler.EventHandler
public void sendEndOfInputNotifications(int entityName, boolean moreToFollow) throws java.lang.Exception
sendEndOfInputNotifications
in interface DefaultEntityHandler.EventHandler
public void sendReaderChangeNotifications(XMLEntityHandler.EntityReader reader, int readerId) throws java.lang.Exception
sendReaderChangeNotifications
in interface DefaultEntityHandler.EventHandler
public boolean externalEntityStandaloneCheck()
externalEntityStandaloneCheck
in interface DefaultEntityHandler.EventHandler
public boolean getValidating()
getValidating
in interface DefaultEntityHandler.EventHandler
public void processCharacters(char[] chars, int offset, int length) throws java.lang.Exception
processCharacters
in interface XMLEntityHandler.CharDataHandler
org.apache.xerces.readers.XMLEntityHandler.CharDataHandler
chars
- character buffer to be processedoffset
- offset in buffer where the data startslength
- length of characters to be processedjava.lang.Exception
- public void processCharacters(int data) throws java.lang.Exception
processCharacters
in interface XMLEntityHandler.CharDataHandler
org.apache.xerces.readers.XMLEntityHandler.CharDataHandler
stringHandle
- StringPool
handle to the character datajava.lang.Exception
- public void processWhitespace(char[] chars, int offset, int length) throws java.lang.Exception
processWhitespace
in interface XMLEntityHandler.CharDataHandler
org.apache.xerces.readers.XMLEntityHandler.CharDataHandler
chars
- character buffer to be processedoffset
- offset in buffer where the data startslength
- length of whitespace to be processedjava.lang.Exception
- public void processWhitespace(int data) throws java.lang.Exception
processWhitespace
in interface XMLEntityHandler.CharDataHandler
org.apache.xerces.readers.XMLEntityHandler.CharDataHandler
stringHandle
- StringPool
handle to the whitespacejava.lang.Exception
- public void scanElementType(XMLEntityHandler.EntityReader entityReader, char fastchar, QName element) throws java.lang.Exception
public boolean scanExpectedElementType(XMLEntityHandler.EntityReader entityReader, char fastchar, QName element) throws java.lang.Exception
public void scanAttributeName(XMLEntityHandler.EntityReader entityReader, QName element, QName attribute) throws java.lang.Exception
public void callStartDocument() throws java.lang.Exception
callStartDocument
in interface XMLDocumentScanner.EventHandler
org.apache.xerces.framework.XMLDocumentScanner.EventHandler
java.lang.Exception
- public void callEndDocument() throws java.lang.Exception
callEndDocument
in interface XMLDocumentScanner.EventHandler
org.apache.xerces.framework.XMLDocumentScanner.EventHandler
java.lang.Exception
- public void callXMLDecl(int version, int encoding, int standalone) throws java.lang.Exception
callXMLDecl
in interface XMLDocumentScanner.EventHandler
org.apache.xerces.framework.XMLDocumentScanner.EventHandler
version
- the handle in the string pool for the version numberencoding
- the handle in the string pool for the encodingstandalong
- the handle in the string pool for the standalone valuejava.lang.Exception
- public void callStandaloneIsYes() throws java.lang.Exception
XMLDocumentScanner.EventHandler
callStandaloneIsYes
in interface XMLDocumentScanner.EventHandler
org.apache.xerces.framework.XMLDocumentScanner.EventHandler
java.lang.Exception
- public void callTextDecl(int version, int encoding) throws java.lang.Exception
callTextDecl
in interface XMLDocumentScanner.EventHandler
org.apache.xerces.framework.XMLDocumentScanner.EventHandler
version
- the handle in the string pool for the version numberencoding
- the handle in the string pool for the encodingjava.lang.Exception
- public void element(QName element) throws java.lang.Exception
element
in interface XMLDocumentScanner.EventHandler
element
- Element name scanned.public boolean attribute(QName element, QName attrName, int attrValue) throws java.lang.Exception
attribute
in interface XMLDocumentScanner.EventHandler
element
- Element name scanned.attrName
- Attribute name scanned.attrValue
- The string pool index of the attribute value.public void callStartElement(QName element) throws java.lang.Exception
callStartElement
in interface XMLDocumentScanner.EventHandler
org.apache.xerces.framework.XMLDocumentScanner.EventHandler
element
- Element name scanned.java.lang.Exception
- public void callEndElement(int readerId) throws java.lang.Exception
callEndElement
in interface XMLDocumentScanner.EventHandler
org.apache.xerces.framework.XMLDocumentScanner.EventHandler
readerId
- the Id of the reader being used to scan the end tag.java.lang.Exception
- public void callStartCDATA() throws java.lang.Exception
callStartCDATA
in interface XMLDocumentScanner.EventHandler
org.apache.xerces.framework.XMLDocumentScanner.EventHandler
java.lang.Exception
- public void callEndCDATA() throws java.lang.Exception
callEndCDATA
in interface XMLDocumentScanner.EventHandler
org.apache.xerces.framework.XMLDocumentScanner.EventHandler
java.lang.Exception
- public void callCharacters(int ch) throws java.lang.Exception
callCharacters
in interface XMLDocumentScanner.EventHandler
org.apache.xerces.framework.XMLDocumentScanner.EventHandler
ch
- the handle in the string pool of the character data that was scannedjava.lang.Exception
- public void callProcessingInstruction(int target, int data) throws java.lang.Exception
callProcessingInstruction
in interface XMLDocumentScanner.EventHandler
org.apache.xerces.framework.XMLDocumentScanner.EventHandler
piTarget
- the handle in the string pool of the processing instruction targepiData
- the handle in the string pool of the processing instruction datajava.lang.Exception
- public void callComment(int comment) throws java.lang.Exception
callComment
in interface XMLDocumentScanner.EventHandler
org.apache.xerces.framework.XMLDocumentScanner.EventHandler
data
- the handle in the string pool of the comment textjava.lang.Exception
- public void startNamespaceDeclScope(int prefix, int uri) throws java.lang.Exception
startNamespaceDeclScope
in interface NamespacesScope.NamespacesHandler
org.apache.xerces.utils.NamespacesScope.NamespacesHandler
prefix
- the StringPool handle of the namespace prefix being declareduri
- the StringPool handle of the namespace's URIjava.lang.Exception
- public void endNamespaceDeclScope(int prefix) throws java.lang.Exception
endNamespaceDeclScope
in interface NamespacesScope.NamespacesHandler
org.apache.xerces.utils.NamespacesScope.NamespacesHandler
prefix
- the StringPool handle of the namespace prefix going out of scopejava.lang.Exception
- public void setRootElementType(QName rootElement)
public int getContentSpecType(int elementIndex)
public int getContentSpecHandle(int elementIndex)
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
protected 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.java.lang.Exception
- Thrown on error.InsertableElementsInfo
protected boolean getAttDefIsExternal(QName element, QName attribute)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |