Overview | Package | Class | Use | Tree | Deprecated | Index | Help
|  | BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

WebLogic Server 6.0sp2 API Reference

## weblogic.apache.xerces.validators.common
Class XMLValidator

    java.lang.Object
      |
      +--weblogic.apache.xerces.validators.common.XMLValidator

public final class XMLValidator
extends java.lang.Object
implements DefaultEntityHandler.EventHandler, XMLEntityHandler.CharDataHandler, XMLDocumentScanner.EventHandler, NamespacesScope.NamespacesHandler

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

This class is based on an implementation from the Apache XML Project. In future releases the XML parser, XSLT processor, and associated classes will likely be updated to be based on a later version of the Apache implementations. Since Apache does not guarantee backwards compatibility between versions of their software, we cannot guarantee backwards compatibility of any of the classes contained in the weblogic.apache package or sub-packages.

Version:
  $Id: XMLValidator.java,v 1.77 2000/08/31 00:41:57 jeffreyr Exp $
Author:
  Copyright © 2001 BEA Systems, Inc. All Rights Reserved.

Inner Class Summary
`static interface` | `XMLValidator.AttributeValidator` AttributeValidator.

Constructor Summary
`XMLValidator(StringPool stringPool, XMLErrorReporter errorReporter, DefaultEntityHandler entityHandler, XMLDocumentScanner documentScanner)` Constructs an XML validator.

Method Summary
`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()`
`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.
`int` | `checkLastChild(int elementIndex, int childrenLength)`
`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.
`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.
`boolean` | `getLoadDTDGrammar()` Returns fLoadDTDGrammar
`boolean` | `getNamespacesEnabled()` Returns true if namespaces are enabled.
`boolean` | `getSchemaValidationEnabled()` Returns true if Schema support is on.
`boolean` | `getUpFrontValidationEnabled()` Returns true if up front validation 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` | `setGrammarResolver(GrammarResolver grammarResolver)`
`void` | `setLoadDTDGrammar(boolean loadDG)` Sets fLoadDTDGrammar when validation is off
`void` | `setNamespacesEnabled(boolean flag)` Sets whether namespaces are enabled.
`void` | `setRootElementType(QName rootElement)` Sets the root element.
`void` | `setSchemaValidationEnabled(boolean flag)` Sets whether Schema support is on/off.
`void` | `setUpFrontValidationEnabled(boolean flag)` Sets up front validation (validation must be turned on).
`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.
`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`

Constructor Detail

### XMLValidator

    public XMLValidator(StringPool stringPool,
                        XMLErrorReporter errorReporter,
                        DefaultEntityHandler entityHandler,
                        XMLDocumentScanner documentScanner)

  Constructs an XML validator.

Method Detail

### setGrammarResolver

    public void setGrammarResolver(GrammarResolver grammarResolver)

### initHandlers

    public void initHandlers(boolean sendCharDataAsCharArray,
                             XMLDocumentHandler docHandler,
                             XMLDocumentHandler.DTDHandler dtdHandler)

  Set char data processing preference and handlers.

### resetOrCopy

    public void resetOrCopy(StringPool stringPool)
                     throws java.lang.Exception

  Reset or copy.

### reset

    public void reset(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.

### setUpFrontValidationEnabled

    public void setUpFrontValidationEnabled(boolean flag)

  Sets up front validation (validation must be turned on).

### getUpFrontValidationEnabled

    public boolean getUpFrontValidationEnabled()

  Returns true if up front validation is on.

### startEntityReference

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

  Start entity reference.
  Specified by:
    startEntityReference in interface DefaultEntityHandler.EventHandler

### endEntityReference

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

  End entity reference.
  Specified by:
    endEntityReference in interface DefaultEntityHandler.EventHandler

### sendEndOfInputNotifications

    public void sendEndOfInputNotifications(int entityName,
                                            boolean moreToFollow)
                                     throws java.lang.Exception

  Send end of input notification.
  Specified by:
    sendEndOfInputNotifications in interface DefaultEntityHandler.EventHandler

### sendReaderChangeNotifications

    public void sendReaderChangeNotifications(XMLEntityHandler.EntityReader reader,
                                              int readerId)
                                       throws java.lang.Exception

  Send reader change notifications.
  Specified by:
    sendReaderChangeNotifications in interface DefaultEntityHandler.EventHandler

### externalEntityStandaloneCheck

    public boolean externalEntityStandaloneCheck()

  External entity standalone check.
  Specified by:
    externalEntityStandaloneCheck in interface DefaultEntityHandler.EventHandler

### getValidating

    public boolean getValidating()

  Return true if validating.
  Specified by:
    getValidating in interface DefaultEntityHandler.EventHandler

### processCharacters

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

  Process characters.
  Specified by:
    processCharacters in interface XMLEntityHandler.CharDataHandler

### processCharacters

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

  Process characters.
  Specified by:
    processCharacters in interface XMLEntityHandler.CharDataHandler

### processWhitespace

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

  Process whitespace.
  Specified by:
    processWhitespace in interface XMLEntityHandler.CharDataHandler

### processWhitespace

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

  Process whitespace.
  Specified by:
    processWhitespace in interface XMLEntityHandler.CharDataHandler

### scanElementType

    public void scanElementType(XMLEntityHandler.EntityReader entityReader,
                                char fastchar,
                                QName element)
                         throws java.lang.Exception

  Scans element type.

### scanExpectedElementType

    public boolean scanExpectedElementType(XMLEntityHandler.EntityReader entityReader,
                                           char fastchar,
                                           QName element)
                                    throws java.lang.Exception

  Scans expected element type.

### scanAttributeName

    public void scanAttributeName(XMLEntityHandler.EntityReader entityReader,
                                  QName element,
                                  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 XMLDocumentScanner.EventHandler

### callEndDocument

    public void callEndDocument()
                         throws java.lang.Exception

  Call end document.
  Specified by:
    callEndDocument in interface XMLDocumentScanner.EventHandler

### callXMLDecl

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

  Call XML declaration.
  Specified by:
    callXMLDecl in interface XMLDocumentScanner.EventHandler

### callStandaloneIsYes

    public void callStandaloneIsYes()
                             throws java.lang.Exception

  Specified by:
    callStandaloneIsYes in interface XMLDocumentScanner.EventHandler

### callTextDecl

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

  Call text declaration.
  Specified by:
    callTextDecl in interface XMLDocumentScanner.EventHandler

### element

    public void element(QName element)
                 throws java.lang.Exception

  Signal the scanning of an element name in a start element tag.
  Specified by:
    element in interface XMLDocumentScanner.EventHandler

  Parameters:
    `element` - Element name scanned.

### attribute

    public boolean attribute(QName element,
                             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 XMLDocumentScanner.EventHandler

  Parameters:
    `element` - Element name scanned.
    `attrName` - Attribute name scanned.
    `attrValue` - The string pool index of the attribute value.

### callStartElement

    public void callStartElement(QName element)
                          throws java.lang.Exception

  Call start element.
  Specified by:
    callStartElement in interface XMLDocumentScanner.EventHandler

### callEndElement

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

  Call end element.
  Specified by:
    callEndElement in interface XMLDocumentScanner.EventHandler

### checkLastChild

    public int checkLastChild(int elementIndex,
                              int childrenLength)
                       throws java.lang.Exception

### callStartCDATA

    public void callStartCDATA()
                        throws java.lang.Exception

  Call start CDATA section.
  Specified by:
    callStartCDATA in interface XMLDocumentScanner.EventHandler

### callEndCDATA

    public void callEndCDATA()
                      throws java.lang.Exception

  Call end CDATA section.
  Specified by:
    callEndCDATA in interface XMLDocumentScanner.EventHandler

### callCharacters

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

  Call characters.
  Specified by:
    callCharacters in interface XMLDocumentScanner.EventHandler

### callProcessingInstruction

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

  Call processing instruction.
  Specified by:
    callProcessingInstruction in interface XMLDocumentScanner.EventHandler

### callComment

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

  Call comment.
  Specified by:
    callComment in interface 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 NamespacesScope.NamespacesHandler

### endNamespaceDeclScope

    public void endNamespaceDeclScope(int prefix)
                               throws java.lang.Exception

  End a namespace declaration scope.
  Specified by:
    endNamespaceDeclScope in interface NamespacesScope.NamespacesHandler

### setRootElementType

    public void setRootElementType(QName rootElement)

  Sets the root element.

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

  Parameters:
    `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.
  Returns:
    The value -1 if fully valid, else the 0 based index of the child that first failed before the insertion point. If the value returned is equal to the number of children, then the specified children are valid but additional content is required to reach a valid ending state.
  Throws:
    java.lang.Exception - Thrown on error.
  See Also:
    `InsertableElementsInfo`

### getAttDefIsExternal

    protected boolean getAttDefIsExternal(QName element,
                                          QName attribute)

  Protected for use by AttributeValidator classes.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Documentation is available at http://e-docs.bea.com/wls/docs60
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD