|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.enhydra.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. |
(package private) class |
XMLValidator.AttValidatorENUMERATION
AttValidatorENUMERATION. |
(package private) class |
XMLValidator.AttValidatorNOTATION
AttValidatorNOTATION. |
(package private) static class |
XMLValidator.ErrorHandler
|
protected class |
XMLValidator.KeyRefValueStore
Key reference value store. |
protected class |
XMLValidator.KeyValueStore
Key value store. |
(package private) static class |
XMLValidator.OrderedHashtable
Ordered hashtable. |
(package private) static class |
XMLValidator.Resolver
|
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 Object |
fgNullObject
|
(package private) boolean |
fInElementContent
|
protected XMLValidator.XPathMatcherStack |
fMatcherStack
Stack of active XPath matchers for identity constraints. |
protected SubstitutionGroupComparator |
fSGComparator
|
(package private) int |
fStandaloneReader
|
(package private) StringPool |
fStringPool
|
(package private) boolean |
fValidating
|
protected XMLValidator.ValueStoreCache |
fValueStoreCache
Cache of value stores for identity constraint fields. |
protected 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. |
String |
getExternalNoNamespaceSchema()
|
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. |
(package private) boolean |
invalidStandaloneAttDef(QName element,
QName attribute)
Returns true if invalid standalone attribute definition. |
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,
String string1)
Report a recoverable xml error. |
protected void |
reportRecoverableXMLError(int majorCode,
int minorCode,
String string1,
String string2)
Report a recoverable xml error. |
protected void |
reportRecoverableXMLError(int majorCode,
int minorCode,
String string1,
String string2,
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(Object value)
|
void |
setExternalSchemas(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. |
(package private) void |
validateUsingDV(DatatypeValidator dv,
String content,
boolean onlyVal3Types)
|
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 |
|
Field Detail |
protected static final boolean DEBUG_IDENTITY_CONSTRAINTS
protected static final boolean DEBUG_VALUE_STORES
StringPool fStringPool
boolean fValidating
boolean fInElementContent
int fStandaloneReader
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 Hashtable UPACheckedGrammarURIs
protected static 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 Exception
public void reset(StringPool stringPool) throws Exception
public void setValidationEnabled(boolean flag) throws Exception
public boolean getValidationEnabled()
public void setSchemaValidationEnabled(boolean flag)
public boolean getSchemaValidationEnabled()
public void setSchemaFullCheckingEnabled(boolean flag)
public void setExternalSchemas(Object value)
public void setExternalNoNamespaceSchema(Object value)
public String getExternalSchemas()
public String getExternalNoNamespaceSchema()
public boolean getSchemaFullCheckingEnabled()
public void setDynamicValidationEnabled(boolean flag) throws 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 Exception
startValueScopeFor
in interface FieldActivator
identityConstraint
- The identity constraint.public XPathMatcher activateField(Field field) throws Exception
activateField
in interface FieldActivator
field
- The field to activate.public void endValueScopeFor(IdentityConstraint identityConstraint) throws Exception
endValueScopeFor
in interface FieldActivator
identityConstraint
- The identity constraint.public void startEntityReference(int entityName, int entityType, int entityContext) throws Exception
startEntityReference
in interface DefaultEntityHandler.EventHandler
public void endEntityReference(int entityName, int entityType, int entityContext) throws Exception
endEntityReference
in interface DefaultEntityHandler.EventHandler
public void sendEndOfInputNotifications(int entityName, boolean moreToFollow) throws Exception
sendEndOfInputNotifications
in interface DefaultEntityHandler.EventHandler
public void sendReaderChangeNotifications(XMLEntityHandler.EntityReader reader, int readerId) throws 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 Exception
processCharacters
in interface XMLEntityHandler.CharDataHandler
org.enhydra.apache.xerces.readers.XMLEntityHandler.CharDataHandler
chars
- character buffer to be processedoffset
- offset in buffer where the data startslength
- length of characters to be processedException
- public void processCharacters(int data) throws Exception
processCharacters
in interface XMLEntityHandler.CharDataHandler
org.enhydra.apache.xerces.readers.XMLEntityHandler.CharDataHandler
stringHandle
- StringPool
handle to the character dataException
- public void processWhitespace(char[] chars, int offset, int length) throws Exception
processWhitespace
in interface XMLEntityHandler.CharDataHandler
org.enhydra.apache.xerces.readers.XMLEntityHandler.CharDataHandler
chars
- character buffer to be processedoffset
- offset in buffer where the data startslength
- length of whitespace to be processedException
- public void processWhitespace(int data) throws Exception
processWhitespace
in interface XMLEntityHandler.CharDataHandler
org.enhydra.apache.xerces.readers.XMLEntityHandler.CharDataHandler
stringHandle
- StringPool
handle to the whitespaceException
- public void scanElementType(XMLEntityHandler.EntityReader entityReader, char fastchar, QName element) throws Exception
public boolean scanExpectedElementType(XMLEntityHandler.EntityReader entityReader, char fastchar, QName element) throws Exception
public void scanAttributeName(XMLEntityHandler.EntityReader entityReader, QName element, QName attribute) throws Exception
public void callStartDocument() throws Exception
callStartDocument
in interface XMLDocumentScanner.EventHandler
org.enhydra.apache.xerces.framework.XMLDocumentScanner.EventHandler
Exception
- public void callEndDocument() throws Exception
callEndDocument
in interface XMLDocumentScanner.EventHandler
org.enhydra.apache.xerces.framework.XMLDocumentScanner.EventHandler
Exception
- public void callXMLDecl(int version, int encoding, int standalone) throws Exception
callXMLDecl
in interface XMLDocumentScanner.EventHandler
org.enhydra.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 valueException
- public void callStandaloneIsYes() throws Exception
XMLDocumentScanner.EventHandler
callStandaloneIsYes
in interface XMLDocumentScanner.EventHandler
org.enhydra.apache.xerces.framework.XMLDocumentScanner.EventHandler
Exception
- public void callTextDecl(int version, int encoding) throws Exception
callTextDecl
in interface XMLDocumentScanner.EventHandler
org.enhydra.apache.xerces.framework.XMLDocumentScanner.EventHandler
version
- the handle in the string pool for the version numberencoding
- the handle in the string pool for the encodingException
- public void element(QName element) throws Exception
element
in interface XMLDocumentScanner.EventHandler
element
- Element name scanned.public boolean attribute(QName element, QName attrName, int attrValue) throws 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 Exception
callStartElement
in interface XMLDocumentScanner.EventHandler
org.enhydra.apache.xerces.framework.XMLDocumentScanner.EventHandler
element
- Element name scanned.Exception
- public void callEndElement(int readerId) throws Exception
callEndElement
in interface XMLDocumentScanner.EventHandler
org.enhydra.apache.xerces.framework.XMLDocumentScanner.EventHandler
readerId
- the Id of the reader being used to scan the end tag.Exception
- public void callStartCDATA() throws Exception
callStartCDATA
in interface XMLDocumentScanner.EventHandler
org.enhydra.apache.xerces.framework.XMLDocumentScanner.EventHandler
Exception
- public void callEndCDATA() throws Exception
callEndCDATA
in interface XMLDocumentScanner.EventHandler
org.enhydra.apache.xerces.framework.XMLDocumentScanner.EventHandler
Exception
- public void callCharacters(int ch) throws Exception
callCharacters
in interface XMLDocumentScanner.EventHandler
org.enhydra.apache.xerces.framework.XMLDocumentScanner.EventHandler
ch
- the handle in the string pool of the character data that was scannedException
- public void callProcessingInstruction(int target, int data) throws Exception
callProcessingInstruction
in interface XMLDocumentScanner.EventHandler
org.enhydra.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 dataException
- public void callComment(int comment) throws Exception
callComment
in interface XMLDocumentScanner.EventHandler
org.enhydra.apache.xerces.framework.XMLDocumentScanner.EventHandler
data
- the handle in the string pool of the comment textException
- public void startNamespaceDeclScope(int prefix, int uri) throws Exception
startNamespaceDeclScope
in interface NamespacesScope.NamespacesHandler
org.enhydra.apache.xerces.utils.NamespacesScope.NamespacesHandler
prefix
- the StringPool handle of the namespace prefix being declareduri
- the StringPool handle of the namespace's URIException
- public void endNamespaceDeclScope(int prefix) throws Exception
endNamespaceDeclScope
in interface NamespacesScope.NamespacesHandler
org.enhydra.apache.xerces.utils.NamespacesScope.NamespacesHandler
prefix
- the StringPool handle of the namespace prefix going out of scopeException
- public void setRootElementType(QName rootElement)
public int getContentSpecType(int elementIndex)
public int getContentSpecHandle(int elementIndex)
protected void reportRecoverableXMLError(int majorCode, int minorCode) throws Exception
protected void reportRecoverableXMLError(int majorCode, int minorCode, int stringIndex1) throws Exception
protected void reportRecoverableXMLError(int majorCode, int minorCode, String string1) throws Exception
protected void reportRecoverableXMLError(int majorCode, int minorCode, int stringIndex1, int stringIndex2) throws Exception
protected void reportRecoverableXMLError(int majorCode, int minorCode, String string1, String string2) throws Exception
protected void reportRecoverableXMLError(int majorCode, int minorCode, String string1, String string2, String string3) throws Exception
protected int whatCanGoHere(int elementIndex, boolean fullyValid, InsertableElementsInfo info) throws 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.Exception
- Thrown on error.InsertableElementsInfo
protected boolean getAttDefIsExternal(QName element, QName attribute)
boolean invalidStandaloneAttDef(QName element, QName attribute)
void validateUsingDV(DatatypeValidator dv, String content, boolean onlyVal3Types) throws Exception, InvalidDatatypeValueException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |