Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.xerces.validators.common
Class XMLValidator  view XMLValidator download XMLValidator.java

java.lang.Object
  extended byorg.apache.xerces.validators.common.XMLValidator
All Implemented Interfaces:
org.apache.xerces.readers.DefaultEntityHandler.EventHandler, org.apache.xerces.utils.NamespacesScope.NamespacesHandler, org.apache.xerces.framework.XMLDocumentScanner.EventHandler, org.apache.xerces.readers.XMLEntityHandler.CharDataHandler

public final class XMLValidator
extends java.lang.Object
implements org.apache.xerces.readers.DefaultEntityHandler.EventHandler, org.apache.xerces.readers.XMLEntityHandler.CharDataHandler, org.apache.xerces.framework.XMLDocumentScanner.EventHandler, org.apache.xerces.utils.NamespacesScope.NamespacesHandler

This class is the super all-in-one validator used by the parser.

Version:
$Id: XMLValidator.java,v 1.2 2000/10/07 18:06:55 markd Exp $

Nested 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
           
(package private) static class XMLValidator.Resolver
           
 
Field Summary
private static int CHUNK_MASK
           
private static int CHUNK_SHIFT
           
private static int CHUNK_SIZE
           
private static boolean DEBUG_ELEMENT_CHILDREN
           
private static boolean DEBUG_PRINT_ATTRIBUTES
           
private static boolean DEBUG_PRINT_CONTENT
           
private static boolean DEBUG_SCHEMA_VALIDATION
           
private  int fANYSymbol
           
private  org.apache.xerces.framework.XMLAttrList fAttrList
           
private  int fAttrListHandle
           
private  org.xml.sax.helpers.LocatorImpl fAttrNameLocator
           
private  XMLValidator.AttributeValidator fAttValidatorDATATYPE
           
private  XMLValidator.AttributeValidator fAttValidatorENUMERATION
           
private  XMLValidator.AttributeValidator fAttValidatorNOTATION
           
private  boolean fBufferDatatype
           
private  boolean fCalledStartDocument
           
private  int fCDATASymbol
           
private  char[] fCharRefData
           
private  boolean fCheckedForSchema
           
private  int fCHILDRENSymbol
           
private  ContentLeafNameTypeVector[] fContentLeafStack
           
private  int[] fContentSpecTypeStack
           
private  int fCurrentContentSpecType
           
private  org.apache.xerces.utils.QName fCurrentElement
           
private  org.apache.xerces.utils.StringPool.CharArrayRange fCurrentElementCharArrayRange
           
private  int fCurrentElementEntity
           
private  int fCurrentElementIndex
           
private  int fCurrentSchemaURI
           
private  int fCurrentScope
           
private  java.lang.StringBuffer fDatatypeBuffer
           
private  org.apache.xerces.validators.datatype.DatatypeValidatorFactoryImpl fDataTypeReg
           
private  int fDATATYPESymbol
           
private  int[] fDeclaration
           
private  boolean fDeclsAreExternal
           
private  org.apache.xerces.framework.XMLDocumentHandler fDocumentHandler
           
private  org.apache.xerces.framework.XMLDocumentScanner fDocumentScanner
           
private  org.apache.xerces.framework.XMLDocumentHandler.DTDHandler fDTDHandler
           
private  boolean fDynamicDisabledByValidation
           
private  boolean fDynamicValidation
           
private  org.apache.xerces.utils.QName[] fElementChildren
           
private  int fElementChildrenLength
           
private  int[] fElementChildrenOffsetStack
           
private  int fElementDepth
           
private  int[] fElementEntityStack
           
private  int[] fElementIndexStack
           
private  org.apache.xerces.utils.QName[] fElementQNamePartsStack
           
private  int fEMPTYSymbol
           
private  int fEmptyURI
           
private  int fENTITIESSymbol
           
private  org.apache.xerces.readers.DefaultEntityHandler fEntityHandler
           
private  int fENTITYSymbol
           
private  int fENUMERATIONSymbol
           
private  int fEpsilonIndex
           
private  org.apache.xerces.framework.XMLErrorReporter fErrorReporter
           
private  int fFIXEDSymbol
           
private  Grammar fGrammar
           
private  boolean fGrammarIsDTDGrammar
           
private  boolean fGrammarIsSchemaGrammar
           
private  int fGrammarNameSpaceIndex
           
private  int[] fGrammarNameSpaceIndexStack
           
private  GrammarResolver fGrammarResolver
           
private  java.util.Hashtable fIdDefs
           
private  int fIDREFSSymbol
           
private  int fIDREFSymbol
           
private  int fIDSymbol
           
(package private)  boolean fInElementContent
           
private  boolean fLoadDTDGrammar
           
private  int fMIXEDSymbol
           
private  boolean fNamespacesEnabled
           
private  int fNamespacesPrefix
           
private  org.apache.xerces.utils.NamespacesScope fNamespacesScope
           
private  boolean fNeedValidationOff
           
private  int fNMTOKENSSymbol
           
private  int fNMTOKENSymbol
           
private  int fNOTATIONSymbol
           
private  int fREQUIREDSymbol
           
private  org.apache.xerces.validators.datatype.StateMessageDatatype fResetID
           
private  org.apache.xerces.validators.datatype.StateMessageDatatype fResetIDRef
           
private  org.apache.xerces.utils.QName fRootElement
           
private  boolean fScanningDTD
           
private  boolean fSchemaValidation
           
private  int[] fScopeStack
           
private  boolean fSeenDoctypeDecl
           
private  boolean fSeenRootElement
           
private  boolean fSendCharDataAsCharArray
           
(package private)  int fStandaloneReader
           
private  org.apache.xerces.validators.datatype.StateMessageDatatype fStoreIDRef
           
(package private)  org.apache.xerces.utils.StringPool fStringPool
           
private  XMLAttributeDecl fTempAttDecl
           
private  XMLAttributeDecl fTempAttributeDecl
           
private  XMLElementDecl fTempElementDecl
           
private  org.apache.xerces.utils.QName fTempQName
           
private  org.apache.xerces.validators.datatype.DatatypeValidator fValENTITIES
           
private  org.apache.xerces.validators.datatype.DatatypeValidator fValENTITY
           
private  org.apache.xerces.validators.datatype.DatatypeValidator fValID
           
private  org.apache.xerces.validators.datatype.StateMessageDatatype fValidateENTITYMsg
           
private  org.apache.xerces.validators.datatype.StateMessageDatatype fValidateIDRef
           
(package private)  boolean fValidating
           
private  boolean fValidationEnabled
           
private  boolean fValidationEnabledByDynamic
           
private  int[] fValidationFlagStack
           
private  org.apache.xerces.validators.datatype.DatatypeValidator fValIDRef
           
private  org.apache.xerces.validators.datatype.DatatypeValidator fValIDRefs
           
private  org.apache.xerces.validators.datatype.DatatypeValidator fValNMTOKEN
           
private  org.apache.xerces.validators.datatype.DatatypeValidator fValNMTOKENS
           
private  org.apache.xerces.validators.datatype.DatatypeValidator fValNOTATION
           
private  boolean fWarningOnDuplicateAttDef
           
private  boolean fWarningOnUndeclaredElements
           
private  int fXMLLang
           
private  int fXsiPrefix
           
private  int fXsiTypeAttValue
           
private  org.apache.xerces.validators.datatype.DatatypeValidator fXsiTypeValidator
           
private  int fXsiURI
           
private static int INITIAL_CHUNK_COUNT
           
private static boolean PRINT_EXCEPTION_STACK_TRACE
           
private static int sizeQNameParts
           
private  int TOP_LEVEL_SCOPE
           
 
Constructor Summary
XMLValidator(org.apache.xerces.utils.StringPool stringPool, org.apache.xerces.framework.XMLErrorReporter errorReporter, org.apache.xerces.readers.DefaultEntityHandler entityHandler, org.apache.xerces.framework.XMLDocumentScanner documentScanner)
          Constructs an XML validator.
 
Method Summary
private  int addDefaultAttributes(int elementIndex, org.apache.xerces.framework.XMLAttrList attrList, int attrIndex, boolean validationEnabled, boolean standalone)
          addDefaultAttributes.
private  int addDTDDefaultAttributes(org.apache.xerces.utils.QName element, org.apache.xerces.framework.XMLAttrList attrList, int attrIndex, boolean validationEnabled, boolean standalone)
          addDTDDefaultAttributes.
 boolean attribute(org.apache.xerces.utils.QName element, org.apache.xerces.utils.QName attrName, int attrValue)
          Signal the scanning of an attribute associated to the previous start element tag.
private  int attributeTypeName(XMLAttributeDecl attrDecl)
           
private  void bindNamespacesToElementAndAttributes(org.apache.xerces.utils.QName element, org.apache.xerces.framework.XMLAttrList attrList)
          Binds namespaces to the element and attributes.
 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(org.apache.xerces.utils.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.
private  void charDataInContent()
          Character data in content.
private  int checkContent(int elementIndex, org.apache.xerces.utils.QName[] children, int childOffset, int childCount)
          Check that the content of an element is valid.
 void element(org.apache.xerces.utils.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.
private  void ensureStackCapacity(int newElementDepth)
           
 boolean externalEntityStandaloneCheck()
          External entity standalone check.
private  int getAttDef(org.apache.xerces.utils.QName element, org.apache.xerces.utils.QName attribute)
          Returns an attribute definition for an element type.
private  int getAttDefByElementIndex(int elementIndex, org.apache.xerces.utils.QName attribute)
          Returns an attribute definition for an element type.
protected  boolean getAttDefIsExternal(org.apache.xerces.utils.QName element, org.apache.xerces.utils.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.
private  XMLContentModel getElementContentModel(int elementIndex)
          Queries the content model for the specified element index.
private  boolean getElementDeclIsExternal(int elementIndex)
          Returns true if the element declaration is external.
 boolean getLoadDTDGrammar()
          Returns fLoadDTDGrammar
private  org.xml.sax.helpers.LocatorImpl getLocatorImpl(org.xml.sax.helpers.LocatorImpl fillin)
          Returns a locator implementation.
 boolean getNamespacesEnabled()
          Returns true if namespaces are enabled.
 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.
private  void init()
          Initialize.
 void initHandlers(boolean sendCharDataAsCharArray, org.apache.xerces.framework.XMLDocumentHandler docHandler, org.apache.xerces.framework.XMLDocumentHandler.DTDHandler dtdHandler)
          Set char data processing preference and handlers.
(package private)  boolean invalidStandaloneAttDef(org.apache.xerces.utils.QName element, org.apache.xerces.utils.QName attribute)
          Returns true if invalid standalone attribute definition.
(package private)  void parseSchemaLocation(java.lang.String schemaLocationStr, java.util.Hashtable locationUriPairs)
           
private  void poolReset()
          Reset pool.
private  void printChildren()
          Checks that all declared elements refer to declared elements in their content models.
private  void printStack()
           
 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.
private  void pushContentLeafStack()
           
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(org.apache.xerces.utils.StringPool stringPool)
          Reset.
private  void resetCommon(org.apache.xerces.utils.StringPool stringPool)
          Reset common.
 void resetOrCopy(org.apache.xerces.utils.StringPool stringPool)
          Reset or copy.
private  void resolveSchemaGrammar(java.lang.String uri)
           
private  void resolveSchemaGrammar(java.lang.String loc, java.lang.String uri)
           
private  void rootElementSpecified(org.apache.xerces.utils.QName rootElement)
          Root element specified.
 void scanAttributeName(org.apache.xerces.readers.XMLEntityHandler.EntityReader entityReader, org.apache.xerces.utils.QName element, org.apache.xerces.utils.QName attribute)
          Scans attribute name.
 void scanElementType(org.apache.xerces.readers.XMLEntityHandler.EntityReader entityReader, char fastchar, org.apache.xerces.utils.QName element)
          Scans element type.
 boolean scanExpectedElementType(org.apache.xerces.readers.XMLEntityHandler.EntityReader entityReader, char fastchar, org.apache.xerces.utils.QName element)
          Scans expected element type.
 void sendEndOfInputNotifications(int entityName, boolean moreToFollow)
          Send end of input notification.
 void sendReaderChangeNotifications(org.apache.xerces.readers.XMLEntityHandler.EntityReader reader, int readerId)
          Send reader change notifications.
 void setDynamicValidationEnabled(boolean flag)
          Sets whether validation is dynamic.
 void setGrammarResolver(GrammarResolver grammarResolver)
           
 void setLoadDTDGrammar(boolean loadDG)
          Sets fLoadDTDGrammar when validation is off
 void setNamespacesEnabled(boolean flag)
          Sets whether namespaces are enabled.
 void setRootElementType(org.apache.xerces.utils.QName rootElement)
          Sets the root element.
 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.
private  boolean switchGrammar(int newGrammarNameSpaceIndex)
          Switchs to correct validating symbol tables when Schema changes.
private  boolean usingStandaloneReader()
          Returns true if using a standalone reader.
private  void validateDTDattribute(org.apache.xerces.utils.QName element, int attValue, XMLAttributeDecl attributeDecl)
           
private  void validateElementAndAttributes(org.apache.xerces.utils.QName element, org.apache.xerces.framework.XMLAttrList attrList)
          Validates element and attributes.
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

PRINT_EXCEPTION_STACK_TRACE

private static final boolean PRINT_EXCEPTION_STACK_TRACE
See Also:
Constant Field Values

DEBUG_PRINT_ATTRIBUTES

private static final boolean DEBUG_PRINT_ATTRIBUTES
See Also:
Constant Field Values

DEBUG_PRINT_CONTENT

private static final boolean DEBUG_PRINT_CONTENT
See Also:
Constant Field Values

DEBUG_SCHEMA_VALIDATION

private static final boolean DEBUG_SCHEMA_VALIDATION
See Also:
Constant Field Values

DEBUG_ELEMENT_CHILDREN

private static final boolean DEBUG_ELEMENT_CHILDREN
See Also:
Constant Field Values

CHUNK_SHIFT

private static final int CHUNK_SHIFT
See Also:
Constant Field Values

CHUNK_SIZE

private static final int CHUNK_SIZE
See Also:
Constant Field Values

CHUNK_MASK

private static final int CHUNK_MASK
See Also:
Constant Field Values

INITIAL_CHUNK_COUNT

private static final int INITIAL_CHUNK_COUNT
See Also:
Constant Field Values

fIdDefs

private java.util.Hashtable fIdDefs

fStoreIDRef

private org.apache.xerces.validators.datatype.StateMessageDatatype fStoreIDRef

fResetID

private org.apache.xerces.validators.datatype.StateMessageDatatype fResetID

fResetIDRef

private org.apache.xerces.validators.datatype.StateMessageDatatype fResetIDRef

fValidateIDRef

private org.apache.xerces.validators.datatype.StateMessageDatatype fValidateIDRef

fValidateENTITYMsg

private org.apache.xerces.validators.datatype.StateMessageDatatype fValidateENTITYMsg

fAttValidatorNOTATION

private XMLValidator.AttributeValidator fAttValidatorNOTATION

fAttValidatorENUMERATION

private XMLValidator.AttributeValidator fAttValidatorENUMERATION

fAttValidatorDATATYPE

private XMLValidator.AttributeValidator fAttValidatorDATATYPE

fStringPool

org.apache.xerces.utils.StringPool fStringPool

fValidating

boolean fValidating

fInElementContent

boolean fInElementContent

fStandaloneReader

int fStandaloneReader

fValidationEnabled

private boolean fValidationEnabled

fDynamicValidation

private boolean fDynamicValidation

fSchemaValidation

private boolean fSchemaValidation

fValidationEnabledByDynamic

private boolean fValidationEnabledByDynamic

fDynamicDisabledByValidation

private boolean fDynamicDisabledByValidation

fWarningOnDuplicateAttDef

private boolean fWarningOnDuplicateAttDef

fWarningOnUndeclaredElements

private boolean fWarningOnUndeclaredElements

fLoadDTDGrammar

private boolean fLoadDTDGrammar

fDeclaration

private int[] fDeclaration

fErrorReporter

private org.apache.xerces.framework.XMLErrorReporter fErrorReporter

fEntityHandler

private org.apache.xerces.readers.DefaultEntityHandler fEntityHandler

fCurrentElement

private org.apache.xerces.utils.QName fCurrentElement

fContentLeafStack

private ContentLeafNameTypeVector[] fContentLeafStack

fValidationFlagStack

private int[] fValidationFlagStack

fScopeStack

private int[] fScopeStack

fGrammarNameSpaceIndexStack

private int[] fGrammarNameSpaceIndexStack

fElementEntityStack

private int[] fElementEntityStack

fElementIndexStack

private int[] fElementIndexStack

fContentSpecTypeStack

private int[] fContentSpecTypeStack

sizeQNameParts

private static final int sizeQNameParts
See Also:
Constant Field Values

fElementQNamePartsStack

private org.apache.xerces.utils.QName[] fElementQNamePartsStack

fElementChildren

private org.apache.xerces.utils.QName[] fElementChildren

fElementChildrenLength

private int fElementChildrenLength

fElementChildrenOffsetStack

private int[] fElementChildrenOffsetStack

fElementDepth

private int fElementDepth

fNamespacesEnabled

private boolean fNamespacesEnabled

fNamespacesScope

private org.apache.xerces.utils.NamespacesScope fNamespacesScope

fNamespacesPrefix

private int fNamespacesPrefix

fRootElement

private org.apache.xerces.utils.QName fRootElement

fAttrListHandle

private int fAttrListHandle

fCurrentElementEntity

private int fCurrentElementEntity

fCurrentElementIndex

private int fCurrentElementIndex

fCurrentContentSpecType

private int fCurrentContentSpecType

fSeenDoctypeDecl

private boolean fSeenDoctypeDecl

TOP_LEVEL_SCOPE

private final int TOP_LEVEL_SCOPE
See Also:
Constant Field Values

fCurrentScope

private int fCurrentScope

fCurrentSchemaURI

private int fCurrentSchemaURI

fEmptyURI

private int fEmptyURI

fXsiPrefix

private int fXsiPrefix

fXsiURI

private int fXsiURI

fXsiTypeAttValue

private int fXsiTypeAttValue

fXsiTypeValidator

private org.apache.xerces.validators.datatype.DatatypeValidator fXsiTypeValidator

fGrammar

private Grammar fGrammar

fGrammarNameSpaceIndex

private int fGrammarNameSpaceIndex

fGrammarResolver

private GrammarResolver fGrammarResolver

fScanningDTD

private boolean fScanningDTD

fDocumentScanner

private org.apache.xerces.framework.XMLDocumentScanner fDocumentScanner

fCalledStartDocument

private boolean fCalledStartDocument

fDocumentHandler

private org.apache.xerces.framework.XMLDocumentHandler fDocumentHandler

fDTDHandler

private org.apache.xerces.framework.XMLDocumentHandler.DTDHandler fDTDHandler

fSeenRootElement

private boolean fSeenRootElement

fAttrList

private org.apache.xerces.framework.XMLAttrList fAttrList

fXMLLang

private int fXMLLang

fAttrNameLocator

private org.xml.sax.helpers.LocatorImpl fAttrNameLocator

fCheckedForSchema

private boolean fCheckedForSchema

fDeclsAreExternal

private boolean fDeclsAreExternal

fCurrentElementCharArrayRange

private org.apache.xerces.utils.StringPool.CharArrayRange fCurrentElementCharArrayRange

fCharRefData

private char[] fCharRefData

fSendCharDataAsCharArray

private boolean fSendCharDataAsCharArray

fBufferDatatype

private boolean fBufferDatatype

fDatatypeBuffer

private java.lang.StringBuffer fDatatypeBuffer

fTempQName

private org.apache.xerces.utils.QName fTempQName

fTempAttDecl

private XMLAttributeDecl fTempAttDecl

fTempAttributeDecl

private XMLAttributeDecl fTempAttributeDecl

fTempElementDecl

private XMLElementDecl fTempElementDecl

fGrammarIsDTDGrammar

private boolean fGrammarIsDTDGrammar

fGrammarIsSchemaGrammar

private boolean fGrammarIsSchemaGrammar

fNeedValidationOff

private boolean fNeedValidationOff

fEMPTYSymbol

private int fEMPTYSymbol

fANYSymbol

private int fANYSymbol

fMIXEDSymbol

private int fMIXEDSymbol

fCHILDRENSymbol

private int fCHILDRENSymbol

fCDATASymbol

private int fCDATASymbol

fIDSymbol

private int fIDSymbol

fIDREFSymbol

private int fIDREFSymbol

fIDREFSSymbol

private int fIDREFSSymbol

fENTITYSymbol

private int fENTITYSymbol

fENTITIESSymbol

private int fENTITIESSymbol

fNMTOKENSymbol

private int fNMTOKENSymbol

fNMTOKENSSymbol

private int fNMTOKENSSymbol

fNOTATIONSymbol

private int fNOTATIONSymbol

fENUMERATIONSymbol

private int fENUMERATIONSymbol

fREQUIREDSymbol

private int fREQUIREDSymbol

fFIXEDSymbol

private int fFIXEDSymbol

fDATATYPESymbol

private int fDATATYPESymbol

fEpsilonIndex

private int fEpsilonIndex

fDataTypeReg

private org.apache.xerces.validators.datatype.DatatypeValidatorFactoryImpl fDataTypeReg

fValID

private org.apache.xerces.validators.datatype.DatatypeValidator fValID

fValIDRef

private org.apache.xerces.validators.datatype.DatatypeValidator fValIDRef

fValIDRefs

private org.apache.xerces.validators.datatype.DatatypeValidator fValIDRefs

fValENTITY

private org.apache.xerces.validators.datatype.DatatypeValidator fValENTITY

fValENTITIES

private org.apache.xerces.validators.datatype.DatatypeValidator fValENTITIES

fValNMTOKEN

private org.apache.xerces.validators.datatype.DatatypeValidator fValNMTOKEN

fValNMTOKENS

private org.apache.xerces.validators.datatype.DatatypeValidator fValNMTOKENS

fValNOTATION

private org.apache.xerces.validators.datatype.DatatypeValidator fValNOTATION
Constructor Detail

XMLValidator

public XMLValidator(org.apache.xerces.utils.StringPool stringPool,
                    org.apache.xerces.framework.XMLErrorReporter errorReporter,
                    org.apache.xerces.readers.DefaultEntityHandler entityHandler,
                    org.apache.xerces.framework.XMLDocumentScanner documentScanner)
Constructs an XML validator.

Method Detail

setGrammarResolver

public void setGrammarResolver(GrammarResolver grammarResolver)

initHandlers

public void initHandlers(boolean sendCharDataAsCharArray,
                         org.apache.xerces.framework.XMLDocumentHandler docHandler,
                         org.apache.xerces.framework.XMLDocumentHandler.DTDHandler dtdHandler)
Set char data processing preference and handlers.


resetOrCopy

public void resetOrCopy(org.apache.xerces.utils.StringPool stringPool)
                 throws java.lang.Exception
Reset or copy.


reset

public void reset(org.apache.xerces.utils.StringPool stringPool)
           throws java.lang.Exception
Reset.


setValidationEnabled

public void setValidationEnabled(boolean flag)
                          throws java.lang.Exception
Turning on validation/dynamic turns on validation if it is off, and this is remembered. Turning off validation DISABLES validation/dynamic if it is on. Turning off validation/dynamic DOES NOT turn off validation if it was explicitly turned on, only if it was turned on BECAUSE OF the call to turn validation/dynamic on. Turning on validation will REENABLE and turn validation/dynamic back on if it was disabled by a call that turned off validation while validation/dynamic was enabled.


getValidationEnabled

public boolean getValidationEnabled()
Returns true if validation is enabled.


setSchemaValidationEnabled

public void setSchemaValidationEnabled(boolean flag)
Sets whether Schema support is on/off.


getSchemaValidationEnabled

public boolean getSchemaValidationEnabled()
Returns true if Schema support is on.


setDynamicValidationEnabled

public void setDynamicValidationEnabled(boolean flag)
                                 throws java.lang.Exception
Sets whether validation is dynamic.


getDynamicValidationEnabled

public boolean getDynamicValidationEnabled()
Returns true if validation is dynamic.


setLoadDTDGrammar

public void setLoadDTDGrammar(boolean loadDG)
Sets fLoadDTDGrammar when validation is off


getLoadDTDGrammar

public boolean getLoadDTDGrammar()
Returns fLoadDTDGrammar


setNamespacesEnabled

public void setNamespacesEnabled(boolean flag)
Sets whether namespaces are enabled.


getNamespacesEnabled

public boolean getNamespacesEnabled()
Returns true if namespaces are enabled.


setWarningOnDuplicateAttDef

public void setWarningOnDuplicateAttDef(boolean flag)
Sets whether duplicate attribute definitions signal a warning.


getWarningOnDuplicateAttDef

public boolean getWarningOnDuplicateAttDef()
Returns true if duplicate attribute definitions signal a warning.


setWarningOnUndeclaredElements

public void setWarningOnUndeclaredElements(boolean flag)
Sets whether undeclared elements signal a warning.


getWarningOnUndeclaredElements

public boolean getWarningOnUndeclaredElements()
Returns true if undeclared elements signal a warning.


startEntityReference

public void startEntityReference(int entityName,
                                 int entityType,
                                 int entityContext)
                          throws java.lang.Exception
Start entity reference.

Specified by:
startEntityReference in interface org.apache.xerces.readers.DefaultEntityHandler.EventHandler

endEntityReference

public void endEntityReference(int entityName,
                               int entityType,
                               int entityContext)
                        throws java.lang.Exception
End entity reference.

Specified by:
endEntityReference in interface org.apache.xerces.readers.DefaultEntityHandler.EventHandler

sendEndOfInputNotifications

public void sendEndOfInputNotifications(int entityName,
                                        boolean moreToFollow)
                                 throws java.lang.Exception
Send end of input notification.

Specified by:
sendEndOfInputNotifications in interface org.apache.xerces.readers.DefaultEntityHandler.EventHandler

sendReaderChangeNotifications

public void sendReaderChangeNotifications(org.apache.xerces.readers.XMLEntityHandler.EntityReader reader,
                                          int readerId)
                                   throws java.lang.Exception
Send reader change notifications.

Specified by:
sendReaderChangeNotifications in interface org.apache.xerces.readers.DefaultEntityHandler.EventHandler

externalEntityStandaloneCheck

public boolean externalEntityStandaloneCheck()
External entity standalone check.

Specified by:
externalEntityStandaloneCheck in interface org.apache.xerces.readers.DefaultEntityHandler.EventHandler

getValidating

public boolean getValidating()
Return true if validating.

Specified by:
getValidating in interface org.apache.xerces.readers.DefaultEntityHandler.EventHandler

processCharacters

public void processCharacters(char[] chars,
                              int offset,
                              int length)
                       throws java.lang.Exception
Process characters.

Specified by:
processCharacters in interface org.apache.xerces.readers.XMLEntityHandler.CharDataHandler

processCharacters

public void processCharacters(int data)
                       throws java.lang.Exception
Process characters.

Specified by:
processCharacters in interface org.apache.xerces.readers.XMLEntityHandler.CharDataHandler

processWhitespace

public void processWhitespace(char[] chars,
                              int offset,
                              int length)
                       throws java.lang.Exception
Process whitespace.

Specified by:
processWhitespace in interface org.apache.xerces.readers.XMLEntityHandler.CharDataHandler

processWhitespace

public void processWhitespace(int data)
                       throws java.lang.Exception
Process whitespace.

Specified by:
processWhitespace in interface org.apache.xerces.readers.XMLEntityHandler.CharDataHandler

scanElementType

public void scanElementType(org.apache.xerces.readers.XMLEntityHandler.EntityReader entityReader,
                            char fastchar,
                            org.apache.xerces.utils.QName element)
                     throws java.lang.Exception
Scans element type.


scanExpectedElementType

public boolean scanExpectedElementType(org.apache.xerces.readers.XMLEntityHandler.EntityReader entityReader,
                                       char fastchar,
                                       org.apache.xerces.utils.QName element)
                                throws java.lang.Exception
Scans expected element type.


scanAttributeName

public void scanAttributeName(org.apache.xerces.readers.XMLEntityHandler.EntityReader entityReader,
                              org.apache.xerces.utils.QName element,
                              org.apache.xerces.utils.QName attribute)
                       throws java.lang.Exception
Scans attribute name.


callStartDocument

public void callStartDocument()
                       throws java.lang.Exception
Call start document.

Specified by:
callStartDocument in interface org.apache.xerces.framework.XMLDocumentScanner.EventHandler

callEndDocument

public void callEndDocument()
                     throws java.lang.Exception
Call end document.

Specified by:
callEndDocument in interface org.apache.xerces.framework.XMLDocumentScanner.EventHandler

callXMLDecl

public void callXMLDecl(int version,
                        int encoding,
                        int standalone)
                 throws java.lang.Exception
Call XML declaration.

Specified by:
callXMLDecl in interface org.apache.xerces.framework.XMLDocumentScanner.EventHandler

callStandaloneIsYes

public void callStandaloneIsYes()
                         throws java.lang.Exception
Description copied from interface: org.apache.xerces.framework.XMLDocumentScanner.EventHandler
Signal standalone = "yes"

Specified by:
callStandaloneIsYes in interface org.apache.xerces.framework.XMLDocumentScanner.EventHandler

callTextDecl

public void callTextDecl(int version,
                         int encoding)
                  throws java.lang.Exception
Call text declaration.

Specified by:
callTextDecl in interface org.apache.xerces.framework.XMLDocumentScanner.EventHandler

element

public void element(org.apache.xerces.utils.QName element)
             throws java.lang.Exception
Signal the scanning of an element name in a start element tag.

Specified by:
element in interface org.apache.xerces.framework.XMLDocumentScanner.EventHandler

attribute

public boolean attribute(org.apache.xerces.utils.QName element,
                         org.apache.xerces.utils.QName attrName,
                         int attrValue)
                  throws java.lang.Exception
Signal the scanning of an attribute associated to the previous start element tag.

Specified by:
attribute in interface org.apache.xerces.framework.XMLDocumentScanner.EventHandler

callStartElement

public void callStartElement(org.apache.xerces.utils.QName element)
                      throws java.lang.Exception
Call start element.

Specified by:
callStartElement in interface org.apache.xerces.framework.XMLDocumentScanner.EventHandler

pushContentLeafStack

private void pushContentLeafStack()
                           throws java.lang.Exception

ensureStackCapacity

private void ensureStackCapacity(int newElementDepth)

callEndElement

public void callEndElement(int readerId)
                    throws java.lang.Exception
Call end element.

Specified by:
callEndElement in interface org.apache.xerces.framework.XMLDocumentScanner.EventHandler

callStartCDATA

public void callStartCDATA()
                    throws java.lang.Exception
Call start CDATA section.

Specified by:
callStartCDATA in interface org.apache.xerces.framework.XMLDocumentScanner.EventHandler

callEndCDATA

public void callEndCDATA()
                  throws java.lang.Exception
Call end CDATA section.

Specified by:
callEndCDATA in interface org.apache.xerces.framework.XMLDocumentScanner.EventHandler

callCharacters

public void callCharacters(int ch)
                    throws java.lang.Exception
Call characters.

Specified by:
callCharacters in interface org.apache.xerces.framework.XMLDocumentScanner.EventHandler

callProcessingInstruction

public void callProcessingInstruction(int target,
                                      int data)
                               throws java.lang.Exception
Call processing instruction.

Specified by:
callProcessingInstruction in interface org.apache.xerces.framework.XMLDocumentScanner.EventHandler

callComment

public void callComment(int comment)
                 throws java.lang.Exception
Call comment.

Specified by:
callComment in interface org.apache.xerces.framework.XMLDocumentScanner.EventHandler

startNamespaceDeclScope

public void startNamespaceDeclScope(int prefix,
                                    int uri)
                             throws java.lang.Exception
Start a new namespace declaration scope.

Specified by:
startNamespaceDeclScope in interface org.apache.xerces.utils.NamespacesScope.NamespacesHandler

endNamespaceDeclScope

public void endNamespaceDeclScope(int prefix)
                           throws java.lang.Exception
End a namespace declaration scope.

Specified by:
endNamespaceDeclScope in interface org.apache.xerces.utils.NamespacesScope.NamespacesHandler

setRootElementType

public void setRootElementType(org.apache.xerces.utils.QName rootElement)
Sets the root element.


getElementDeclIsExternal

private boolean getElementDeclIsExternal(int elementIndex)
Returns true if the element declaration is external.

Note: This method is primarilly useful for DTDs with internal and external subsets.


getContentSpecType

public int getContentSpecType(int elementIndex)
Returns the content spec type for an element index.


getContentSpecHandle

public int getContentSpecHandle(int elementIndex)
Returns the content spec handle for an element index.


reportRecoverableXMLError

protected void reportRecoverableXMLError(int majorCode,
                                         int minorCode)
                                  throws java.lang.Exception
Report a recoverable xml error.


reportRecoverableXMLError

protected void reportRecoverableXMLError(int majorCode,
                                         int minorCode,
                                         int stringIndex1)
                                  throws java.lang.Exception
Report a recoverable xml error.


reportRecoverableXMLError

protected void reportRecoverableXMLError(int majorCode,
                                         int minorCode,
                                         java.lang.String string1)
                                  throws java.lang.Exception
Report a recoverable xml error.


reportRecoverableXMLError

protected void reportRecoverableXMLError(int majorCode,
                                         int minorCode,
                                         int stringIndex1,
                                         int stringIndex2)
                                  throws java.lang.Exception
Report a recoverable xml error.


reportRecoverableXMLError

protected void reportRecoverableXMLError(int majorCode,
                                         int minorCode,
                                         java.lang.String string1,
                                         java.lang.String string2)
                                  throws java.lang.Exception
Report a recoverable xml error.


reportRecoverableXMLError

protected void reportRecoverableXMLError(int majorCode,
                                         int minorCode,
                                         java.lang.String string1,
                                         java.lang.String string2,
                                         java.lang.String string3)
                                  throws java.lang.Exception
Report a recoverable xml error.


whatCanGoHere

protected 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.


getAttDefIsExternal

protected boolean getAttDefIsExternal(org.apache.xerces.utils.QName element,
                                      org.apache.xerces.utils.QName attribute)
Protected for use by AttributeValidator classes.


usingStandaloneReader

private boolean usingStandaloneReader()
Returns true if using a standalone reader.


getLocatorImpl

private org.xml.sax.helpers.LocatorImpl getLocatorImpl(org.xml.sax.helpers.LocatorImpl fillin)
Returns a locator implementation.


poolReset

private void poolReset()
Reset pool.


resetCommon

private void resetCommon(org.apache.xerces.utils.StringPool stringPool)
                  throws java.lang.Exception
Reset common.


init

private void init()
Initialize.


addDefaultAttributes

private int addDefaultAttributes(int elementIndex,
                                 org.apache.xerces.framework.XMLAttrList attrList,
                                 int attrIndex,
                                 boolean validationEnabled,
                                 boolean standalone)
                          throws java.lang.Exception
addDefaultAttributes.


addDTDDefaultAttributes

private int addDTDDefaultAttributes(org.apache.xerces.utils.QName element,
                                    org.apache.xerces.framework.XMLAttrList attrList,
                                    int attrIndex,
                                    boolean validationEnabled,
                                    boolean standalone)
                             throws java.lang.Exception
addDTDDefaultAttributes.


getElementContentModel

private XMLContentModel getElementContentModel(int elementIndex)
                                        throws CMException
Queries the content model for the specified element index.


getAttDef

private int getAttDef(org.apache.xerces.utils.QName element,
                      org.apache.xerces.utils.QName attribute)
Returns an attribute definition for an element type.


getAttDefByElementIndex

private int getAttDefByElementIndex(int elementIndex,
                                    org.apache.xerces.utils.QName attribute)
Returns an attribute definition for an element type.


rootElementSpecified

private void rootElementSpecified(org.apache.xerces.utils.QName rootElement)
                           throws java.lang.Exception
Root element specified.


switchGrammar

private boolean switchGrammar(int newGrammarNameSpaceIndex)
                       throws java.lang.Exception
Switchs to correct validating symbol tables when Schema changes.


bindNamespacesToElementAndAttributes

private void bindNamespacesToElementAndAttributes(org.apache.xerces.utils.QName element,
                                                  org.apache.xerces.framework.XMLAttrList attrList)
                                           throws java.lang.Exception
Binds namespaces to the element and attributes.


parseSchemaLocation

void parseSchemaLocation(java.lang.String schemaLocationStr,
                         java.util.Hashtable locationUriPairs)

resolveSchemaGrammar

private void resolveSchemaGrammar(java.lang.String loc,
                                  java.lang.String uri)
                           throws java.lang.Exception

resolveSchemaGrammar

private void resolveSchemaGrammar(java.lang.String uri)
                           throws java.lang.Exception

attributeTypeName

private int attributeTypeName(XMLAttributeDecl attrDecl)

validateElementAndAttributes

private void validateElementAndAttributes(org.apache.xerces.utils.QName element,
                                          org.apache.xerces.framework.XMLAttrList attrList)
                                   throws java.lang.Exception
Validates element and attributes.


validateDTDattribute

private void validateDTDattribute(org.apache.xerces.utils.QName element,
                                  int attValue,
                                  XMLAttributeDecl attributeDecl)
                           throws java.lang.Exception

charDataInContent

private void charDataInContent()
Character data in content.


checkContent

private int checkContent(int elementIndex,
                         org.apache.xerces.utils.QName[] children,
                         int childOffset,
                         int childCount)
                  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.


printChildren

private void printChildren()
Checks that all declared elements refer to declared elements in their content models. This method calls out to the error handler to indicate warnings.


printStack

private void printStack()

invalidStandaloneAttDef

boolean invalidStandaloneAttDef(org.apache.xerces.utils.QName element,
                                org.apache.xerces.utils.QName attribute)
Returns true if invalid standalone attribute definition.