ilog.cpl.storage
Class IlpAbstractSAXHandler

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by ilog.cpl.storage.IlpAbstractSAXHandler
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler
Direct Known Subclasses:
IlpAbstractChainedSAXHandler

public abstract class IlpAbstractSAXHandler
extends DefaultHandler

Abstract SAX handler. It contains some code to retrieve the text of an element and manage the state of the handler (this last feature is currently not documented).

Since:
JTGO 3.0

Constructor Summary
IlpAbstractSAXHandler()
           
 
Method Summary
 void characters(char[] ch, int start, int length)
          Notifies the text in one element.
protected  boolean checkState(int testState)
          Check if the given state is present.
 void clearContent()
          Erases the current content.
protected  void clearState()
          Clear the state flag.
 void error(SAXParseException ex)
          Process the given SAX exception logging it as an error.
 void fatalError(SAXParseException ex)
          Process the given SAX exception logging it as a fatal error.
 String getContent()
          Returns the content of an element.
abstract  Locator getLocator()
          Returns the locator used by the handler.
abstract  Logger getLogger()
          Returns the logger used by the handler.
protected  int getState()
           
abstract  XMLReader getXMLReader()
          Returns the XMLReader used by the handler.
 void ignoreUntil(String element, String reason)
           
protected  void log(Level level, String message, Object[] parameters)
          Logs a message with full location information.
protected  void logIgnoreElement(String element, String reason)
          Logs information about an element being ignored.
protected  void processSAXParseException(SAXParseException se, Level level)
           
protected  void removeState(int oldState)
           
protected  void setState(int newState)
           
protected  void throwSAXParseException(String message)
          Throws a SAXParseException.
 void warning(SAXParseException ex)
          Process the given SAX exception logging it as a warning.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endElement, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlpAbstractSAXHandler

public IlpAbstractSAXHandler()
Method Detail

getState

protected int getState()
Returns:
State
Internal method or field: do not use!

setState

protected void setState(int newState)
Parameters:
newState - New state value
Internal method or field: do not use!

removeState

protected void removeState(int oldState)
Parameters:
oldState - State to be removed
Internal method or field: do not use!

clearState

protected void clearState()
Clear the state flag.

Internal method or field: do not use!

checkState

protected boolean checkState(int testState)
Check if the given state is present.

Parameters:
testState - State
Returns:
true if state is present
Internal method or field: do not use!

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Notifies the text in one element. Its behavior is to store the characters in the content. If you redefine this method, do not forget to call this version, otherwise all "content" methods will not work.

Specified by:
characters in interface ContentHandler
Overrides:
characters in class DefaultHandler
Throws:
SAXException
See Also:
getContent()

getContent

public String getContent()
Returns the content of an element. This method should be called in endElement only.


clearContent

public void clearContent()
Erases the current content. This method should usually be called in startElement.


ignoreUntil

public void ignoreUntil(String element,
                        String reason)
Internal method or field: do not use!

warning

public void warning(SAXParseException ex)
Process the given SAX exception logging it as a warning.

Specified by:
warning in interface ErrorHandler
Overrides:
warning in class DefaultHandler
Parameters:
ex - Exception

error

public void error(SAXParseException ex)
Process the given SAX exception logging it as an error.

Specified by:
error in interface ErrorHandler
Overrides:
error in class DefaultHandler
Parameters:
ex - Exception

fatalError

public void fatalError(SAXParseException ex)
                throws SAXException
Process the given SAX exception logging it as a fatal error.

Specified by:
fatalError in interface ErrorHandler
Overrides:
fatalError in class DefaultHandler
Parameters:
ex - Exception
Throws:
SAXException

processSAXParseException

protected void processSAXParseException(SAXParseException se,
                                        Level level)
Internal method or field: do not use!

throwSAXParseException

protected void throwSAXParseException(String message)
                               throws SAXParseException
Throws a SAXParseException.

Note that the location information is correct only when invoking the events in the SAX ContentHandler interface. The application should not attempt to use this information at any other time.

Parameters:
message - The message to appear in the SAXParseException.
Throws:
SAXParseException

logIgnoreElement

protected void logIgnoreElement(String element,
                                String reason)
Logs information about an element being ignored.

This method logs the following message as a warning: "Ignoring element element parameter (line: line number, col: column number) the reason parameter"

Parameters:
element - The element being ignored.
reason - The reason why the current element is ignored.

log

protected void log(Level level,
                   String message,
                   Object[] parameters)
Logs a message with full location information.

Note that the location information is correct only when invoking the events in the SAX ContentHandler interface. The application should not attempt to use this information at any other time.

Parameters:
level - The log level.
message - The message. The first three parameters of the message will be replaced as follows: {0} by the line number, {1} by the column number, {2} by the public id. Any subsequent parameter, like {3}, will replace the parameters given in parameter. Note that the current element is retrieved from the Locator and may be null.
parameters - The parameters for the message. The first parameter in this array replaces {3} in the message, the second replaces {4}, and so on. parameters may be null

getLogger

public abstract Logger getLogger()
Returns the logger used by the handler.

Each implementation should return the logger which is used.


getLocator

public abstract Locator getLocator()
Returns the locator used by the handler.


getXMLReader

public abstract XMLReader getXMLReader()
Returns the XMLReader used by the handler.



Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.   . All Rights Reserved.