BEA Systems, Inc.

WebLogic Server 6.1 API Reference

weblogic.apache.xerces.framework
Class XMLDocumentScanner

java.lang.Object
  |
  +--weblogic.apache.xerces.framework.XMLDocumentScanner

public final class XMLDocumentScanner
extends java.lang.Object

This class recognizes most of the grammer for an XML processor. Additional support is provided by the XMLEntityHandler, via the XMLEntityReader instances it creates, which are used to process simple constructs like string literals and character data between markup. The XMLDTDScanner class contains the remaining support for the grammer of DTD declarations. When a <!DOCTYPE ...> is found in the document, the scanDoctypeDecl method will then be called and the XMLDocumentScanner subclass is responsible for "connecting" that method to the corresponding method provided by the XMLDTDScanner class.

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: XMLDocumentScanner.java,v 1.11 2001/02/23 23:49:15 lynnm Exp $

Inner Class Summary
static interface XMLDocumentScanner.EventHandler
          This interface must be implemented by the users of the XMLDocumentScanner class.
 
Field Summary
static int RESULT_DUPLICATE_ATTR
           
static int RESULT_FAILURE
           
static int RESULT_SUCCESS
           
 
Constructor Summary
XMLDocumentScanner(StringPool stringPool, XMLErrorReporter errorReporter, XMLEntityHandler entityHandler, XMLEntityHandler.CharBuffer literalData)
          Constructor
 
Method Summary
 boolean atEndOfInput()
          Tell if scanner has reached end of input
 void checkXMLLangAttributeValue(int langValue)
          Check the value of an XML Language attribute
 void endOfInput(int entityName, boolean moreToFollow)
          Handle the end of input
 int getCurrentElementType()
           
 boolean getLoadExternalDTD()
          Returns true if loading the external DTD is turned on.
 int getMaxEntityRefs()
           
 boolean getNamespacesEnabled()
          Returns whether the parser processes namespaces.
 boolean getValidationEnabled()
          Returns true if validation is turned on.
 boolean parseSome(boolean doItAll)
          Entry point for parsing
 boolean parseUntilRoot(boolean doItAll)
           
 void readerChange(XMLEntityHandler.EntityReader nextReader, int nextReaderId)
          Change readers
 void reset(StringPool stringPool, XMLEntityHandler.CharBuffer literalData)
          reset the parser so that the instance can be reused
 int scanAttValue(QName element, QName attribute, boolean asSymbol)
          Scan an attribute value
 void setDTDHandler(XMLDocumentHandler.DTDHandler dtdHandler)
          Set the DTD handler.
 void setEventHandler(XMLDocumentScanner.EventHandler eventHandler)
          Set the event handler
 void setGrammarResolver(GrammarResolver resolver)
          Sets the grammar resolver.
 void setLoadExternalDTD(boolean enabled)
          Sets whether the parser loads the external DTD.
 void setMaxEntityRefs(int max)
           
 void setNamespacesEnabled(boolean enabled)
          Sets whether the parser preprocesses namespaces.
 void setValidationEnabled(boolean enabled)
          Sets whether the parser validates.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESULT_SUCCESS

public static final int RESULT_SUCCESS

RESULT_FAILURE

public static final int RESULT_FAILURE

RESULT_DUPLICATE_ATTR

public static final int RESULT_DUPLICATE_ATTR
Constructor Detail

XMLDocumentScanner

public XMLDocumentScanner(StringPool stringPool,
                          XMLErrorReporter errorReporter,
                          XMLEntityHandler entityHandler,
                          XMLEntityHandler.CharBuffer literalData)
Constructor
Method Detail

setEventHandler

public void setEventHandler(XMLDocumentScanner.EventHandler eventHandler)
Set the event handler

Parameters:
eventHandler - The place to send our callbacks.

setDTDHandler

public void setDTDHandler(XMLDocumentHandler.DTDHandler dtdHandler)
Set the DTD handler.

setGrammarResolver

public void setGrammarResolver(GrammarResolver resolver)
Sets the grammar resolver.

reset

public void reset(StringPool stringPool,
                  XMLEntityHandler.CharBuffer literalData)
reset the parser so that the instance can be reused

Parameters:
stringPool - the string pool instance to be used by the reset parser

parseSome

public boolean parseSome(boolean doItAll)
                  throws java.lang.Exception
Entry point for parsing

Parameters:
doItAll - if true the entire document is parsed otherwise just the next segment of the document is parsed

parseUntilRoot

public boolean parseUntilRoot(boolean doItAll)
                       throws java.lang.Exception

readerChange

public void readerChange(XMLEntityHandler.EntityReader nextReader,
                         int nextReaderId)
                  throws java.lang.Exception
Change readers

Parameters:
nextReader - the new reader that the scanner will use
nextReaderId - id of the reader to change to
Throws:
throws - java.lang.Exception

endOfInput

public void endOfInput(int entityName,
                       boolean moreToFollow)
                throws java.lang.Exception
Handle the end of input

Parameters:
entityName - the handle in the string pool of the name of the entity which has reached end of input
moreToFollow - if true, there is still input left to process in other readers
Throws:
java.lang.Exception -  

atEndOfInput

public boolean atEndOfInput()
Tell if scanner has reached end of input

Returns:
true if scanner has reached end of input.

scanAttValue

public int scanAttValue(QName element,
                        QName attribute,
                        boolean asSymbol)
                 throws java.lang.Exception
Scan an attribute value

Parameters:
elementType - handle to the element whose attribute value is being scanned
attrName - handle in the string pool of the name of attribute being scanned
asSymbol - controls whether the value is a string (duplicates allowed) or a symbol (duplicates not allowed)
Returns:
handle in the string pool of the scanned value
Throws:
java.lang.Exception -  

checkXMLLangAttributeValue

public void checkXMLLangAttributeValue(int langValue)
                                throws java.lang.Exception
Check the value of an XML Language attribute

Parameters:
langValue - the handle in the string pool of the value to be checked
Throws:
java.lang.Exception -  

getCurrentElementType

public int getCurrentElementType()

setNamespacesEnabled

public void setNamespacesEnabled(boolean enabled)
Sets whether the parser preprocesses namespaces.

getNamespacesEnabled

public boolean getNamespacesEnabled()
Returns whether the parser processes namespaces.

setValidationEnabled

public void setValidationEnabled(boolean enabled)
Sets whether the parser validates.

getValidationEnabled

public boolean getValidationEnabled()
Returns true if validation is turned on.

setMaxEntityRefs

public void setMaxEntityRefs(int max)

getMaxEntityRefs

public int getMaxEntityRefs()

setLoadExternalDTD

public void setLoadExternalDTD(boolean enabled)
Sets whether the parser loads the external DTD.

getLoadExternalDTD

public boolean getLoadExternalDTD()
Returns true if loading the external DTD is turned on.

Documentation is available at
http://download.oracle.com/docs/cd/E13222_01/wls/docs61

WebLogic classes and methods that do not appear in this reference are not public and are not supported.