org.quartz.xml
Class JobSchedulingDataProcessor

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.quartz.xml.JobSchedulingDataProcessor
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class JobSchedulingDataProcessor
extends org.xml.sax.helpers.DefaultHandler

Parses an XML file that declares Jobs and their schedules (Triggers). The xml document must conform to the format defined in "job_scheduling_data_1_5.dtd" or "job_scheduling_data_1_5.xsd" After creating an instance of this class, you should call one of the processFile() functions, after which you may call the getScheduledJobs() function to get a handle to the defined Jobs and Triggers, which can then be scheduled with the Scheduler. Alternatively, you could call the processFileAndScheduleJobs() function to do all of this in one step. The same instance can be used again and again, with the list of defined Jobs being cleared each time you call a processFile method, however a single instance is not thread-safe.

Author:
Chris Bonham, James House, pl47ypus

Nested Class Summary
 class JobSchedulingDataProcessor.CalendarRuleSet
          RuleSet for common Calendar tags.
 class JobSchedulingDataProcessor.DateConverter
          Standard Converter implementation that converts an incoming String into a java.util.Date object, optionally using a default value or throwing a ConversionException if a conversion error occurs.
 class JobSchedulingDataProcessor.MisfireInstructionRule
          This rule translates the trigger misfire instruction constant name into its corresponding value.
 class JobSchedulingDataProcessor.SimpleConverterRule
          This rule is needed to fix QUARTZ-153.
 class JobSchedulingDataProcessor.TimeZoneConverter
          Standard Converter implementation that converts an incoming String into a java.util.TimeZone object throwing a ConversionException if a conversion error occurs.
 class JobSchedulingDataProcessor.TriggerRuleSet
          RuleSet for common Trigger tags.
 
Field Summary
protected  java.util.List calsToSchedule
           
protected  ClassLoadHelper classLoadHelper
           
protected  org.apache.commons.digester.Digester digester
           
protected static java.lang.String DTD_DATE_FORMAT
          Legacy DTD version 1.0 date format.
protected  java.util.List jobsToSchedule
           
protected  java.util.List listenersToSchedule
           
static java.lang.String QUARTZ_DTD
           
static java.lang.String QUARTZ_NS
           
static java.lang.String QUARTZ_PUBLIC_ID
           
static java.lang.String QUARTZ_SCHEMA
           
static java.lang.String QUARTZ_SYSTEM_ID
           
static java.lang.String QUARTZ_SYSTEM_ID_DIR_PROP
           
static java.lang.String QUARTZ_SYSTEM_ID_PREFIX
           
static java.lang.String QUARTZ_XML_FILE_NAME
           
static java.lang.String QUARTZ_XSD
           
protected  java.util.Map scheduledJobs
           
protected static java.lang.String TAG_ALLOWS_TRANSIENT_DATA
           
protected static java.lang.String TAG_BASE_CALENDAR
           
protected static java.lang.String TAG_CALENDAR
           
protected static java.lang.String TAG_CALENDAR_NAME
           
protected static java.lang.String TAG_CLASS_NAME
           
protected static java.lang.String TAG_CRON
           
protected static java.lang.String TAG_CRON_EXPRESSION
           
protected static java.lang.String TAG_DESCRIPTION
           
protected static java.lang.String TAG_DURABILITY
           
protected static java.lang.String TAG_END_TIME
           
protected static java.lang.String TAG_ENTRY
           
protected static java.lang.String TAG_GROUP
           
protected static java.lang.String TAG_JOB
           
protected static java.lang.String TAG_JOB_CLASS
           
protected static java.lang.String TAG_JOB_DATA_MAP
           
protected static java.lang.String TAG_JOB_DETAIL
           
protected static java.lang.String TAG_JOB_GROUP
           
protected static java.lang.String TAG_JOB_LISTENER
           
protected static java.lang.String TAG_JOB_LISTENER_REF
           
protected static java.lang.String TAG_JOB_NAME
           
protected static java.lang.String TAG_KEY
           
protected static java.lang.String TAG_MISFIRE_INSTRUCTION
           
protected static java.lang.String TAG_NAME
           
protected static java.lang.String TAG_OVERWRITE_EXISTING_JOBS
           
protected static java.lang.String TAG_QUARTZ
           
protected static java.lang.String TAG_RECOVER
           
protected static java.lang.String TAG_REPEAT_COUNT
           
protected static java.lang.String TAG_REPEAT_INTERVAL
           
protected static java.lang.String TAG_SIMPLE
           
protected static java.lang.String TAG_START_TIME
           
protected static java.lang.String TAG_TIME_ZONE
           
protected static java.lang.String TAG_TRIGGER
           
protected static java.lang.String TAG_VALUE
           
protected static java.lang.String TAG_VOLATILITY
           
protected  java.util.Collection validationExceptions
           
protected static java.lang.String XSD_DATE_FORMAT
          XML Schema dateTime datatype format.
 
Constructor Summary
JobSchedulingDataProcessor(ClassLoadHelper clh, boolean validating, boolean validatingSchema)
          Constructor for QuartzMetaDataProcessor.
 
Method Summary
 void addCalendar(Scheduler sched, CalendarBundle calendarBundle)
          Adds a calendar.
 void addCalendarToSchedule(CalendarBundle cal)
           
protected  boolean addCustomDigesterRules(org.apache.commons.digester.Digester digester)
          Template method provided as a hook for those who wish to extend this class and add more functionality.
protected  void addDefaultDigesterRules(org.apache.commons.digester.Digester digester)
          Add the default set of digest rules
 void addJobToSchedule(JobSchedulingBundle job)
           
 void addListenerToSchedule(JobListener listener)
           
protected  void addScheduledJob(JobSchedulingBundle job)
          Adds a scheduled job.
protected  void addValidationException(org.xml.sax.SAXException e)
          Adds a detected validation exception.
protected  void clearValidationExceptions()
          Resets the the number of detected validation exceptions.
 void error(org.xml.sax.SAXParseException e)
          ErrorHandler interface.
 void fatalError(org.xml.sax.SAXParseException e)
          ErrorHandler interface.
protected  java.io.InputStream getInputStream(java.lang.String fileName)
          Returns an InputStream from the fileName as a resource.
protected  org.apache.commons.logging.Log getLog()
           
 boolean getOverWriteExistingJobs()
          Returns whether to overwrite existing jobs.
 JobSchedulingBundle getScheduledJob(java.lang.String name)
          Returns a JobSchedulingBundle for the job name.
 java.util.Map getScheduledJobs()
          Returns a Map of scheduled jobs.
protected  java.lang.String getSystemIdForFileName(java.lang.String fileName)
          For the given fileName, attempt to expand it to its full path for use as a system id.
protected  java.net.URL getURL(java.lang.String fileName)
          Returns an URL from the fileName as a resource.
 boolean getUseContextClassLoader()
          Returns whether to use the context class loader.
protected  void initDigester(boolean validating, boolean validatingSchema)
          Initializes the digester.
protected  void initSchemaValidation(boolean validatingSchema)
          Initializes the digester for XML Schema validation.
protected  void maybeThrowValidationException()
          Throws a ValidationException if the number of validationExceptions detected is greater than zero.
 void processFile()
          Process the xml file in the default location (a file named "quartz_jobs.xml" in the current working directory).
 void processFile(java.lang.String fileName)
          Process the xml file named fileName.
 void processFile(java.lang.String fileName, java.lang.String systemId)
          Process the xmlfile named fileName with the given system ID.
 void processFileAndScheduleJobs(Scheduler sched, boolean overWriteExistingJobs)
          Process the xml file in the default location, and schedule all of the jobs defined within it.
 void processFileAndScheduleJobs(java.lang.String fileName, Scheduler sched, boolean overWriteExistingJobs)
          Process the xml file in the given location, and schedule all of the jobs defined within it.
 void processFileAndScheduleJobs(java.lang.String fileName, java.lang.String systemId, Scheduler sched, boolean overWriteExistingJobs)
          Process the xml file in the given location, and schedule all of the jobs defined within it.
 void processStream(java.io.InputStream stream, java.lang.String systemId)
          Process the xmlfile named fileName with the given system ID.
 org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
          EntityResolver interface.
 void scheduleJob(JobSchedulingBundle job)
          Schedules a given job and trigger (both wrapped by a JobSchedulingBundle).
 void scheduleJob(JobSchedulingBundle job, Scheduler sched, boolean localOverWriteExistingJobs)
          Schedules a given job and trigger (both wrapped by a JobSchedulingBundle).
 void scheduleJobs(java.util.Map jobBundles, Scheduler sched, boolean overWriteExistingJobs)
          Add the Jobs and Triggers defined in the given map of JobSchedulingBundle s to the given scheduler.
 void setOverWriteExistingJobs(boolean overWriteExistingJobs)
          Sets whether to overwrite existing jobs.
 void setUseContextClassLoader(boolean useContextClassLoader)
          Sets whether to use the context class loader.
 void warning(org.xml.sax.SAXParseException e)
          ErrorHandler interface.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endElement, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

QUARTZ_PUBLIC_ID

public static final java.lang.String QUARTZ_PUBLIC_ID
See Also:
Constant Field Values

QUARTZ_SYSTEM_ID

public static final java.lang.String QUARTZ_SYSTEM_ID
See Also:
Constant Field Values

QUARTZ_DTD

public static final java.lang.String QUARTZ_DTD
See Also:
Constant Field Values

QUARTZ_NS

public static final java.lang.String QUARTZ_NS
See Also:
Constant Field Values

QUARTZ_SCHEMA

public static final java.lang.String QUARTZ_SCHEMA
See Also:
Constant Field Values

QUARTZ_XSD

public static final java.lang.String QUARTZ_XSD
See Also:
Constant Field Values

QUARTZ_SYSTEM_ID_DIR_PROP

public static final java.lang.String QUARTZ_SYSTEM_ID_DIR_PROP
See Also:
Constant Field Values

QUARTZ_XML_FILE_NAME

public static final java.lang.String QUARTZ_XML_FILE_NAME
See Also:
Constant Field Values

QUARTZ_SYSTEM_ID_PREFIX

public static final java.lang.String QUARTZ_SYSTEM_ID_PREFIX
See Also:
Constant Field Values

TAG_QUARTZ

protected static final java.lang.String TAG_QUARTZ
See Also:
Constant Field Values

TAG_OVERWRITE_EXISTING_JOBS

protected static final java.lang.String TAG_OVERWRITE_EXISTING_JOBS
See Also:
Constant Field Values

TAG_JOB_LISTENER

protected static final java.lang.String TAG_JOB_LISTENER
See Also:
Constant Field Values

TAG_CALENDAR

protected static final java.lang.String TAG_CALENDAR
See Also:
Constant Field Values

TAG_CLASS_NAME

protected static final java.lang.String TAG_CLASS_NAME
See Also:
Constant Field Values

TAG_DESCRIPTION

protected static final java.lang.String TAG_DESCRIPTION
See Also:
Constant Field Values

TAG_BASE_CALENDAR

protected static final java.lang.String TAG_BASE_CALENDAR
See Also:
Constant Field Values

TAG_MISFIRE_INSTRUCTION

protected static final java.lang.String TAG_MISFIRE_INSTRUCTION
See Also:
Constant Field Values

TAG_CALENDAR_NAME

protected static final java.lang.String TAG_CALENDAR_NAME
See Also:
Constant Field Values

TAG_JOB

protected static final java.lang.String TAG_JOB
See Also:
Constant Field Values

TAG_JOB_DETAIL

protected static final java.lang.String TAG_JOB_DETAIL
See Also:
Constant Field Values

TAG_NAME

protected static final java.lang.String TAG_NAME
See Also:
Constant Field Values

TAG_GROUP

protected static final java.lang.String TAG_GROUP
See Also:
Constant Field Values

TAG_JOB_CLASS

protected static final java.lang.String TAG_JOB_CLASS
See Also:
Constant Field Values

TAG_JOB_LISTENER_REF

protected static final java.lang.String TAG_JOB_LISTENER_REF
See Also:
Constant Field Values

TAG_VOLATILITY

protected static final java.lang.String TAG_VOLATILITY
See Also:
Constant Field Values

TAG_DURABILITY

protected static final java.lang.String TAG_DURABILITY
See Also:
Constant Field Values

TAG_RECOVER

protected static final java.lang.String TAG_RECOVER
See Also:
Constant Field Values

TAG_JOB_DATA_MAP

protected static final java.lang.String TAG_JOB_DATA_MAP
See Also:
Constant Field Values

TAG_ENTRY

protected static final java.lang.String TAG_ENTRY
See Also:
Constant Field Values

TAG_KEY

protected static final java.lang.String TAG_KEY
See Also:
Constant Field Values

TAG_ALLOWS_TRANSIENT_DATA

protected static final java.lang.String TAG_ALLOWS_TRANSIENT_DATA
See Also:
Constant Field Values

TAG_VALUE

protected static final java.lang.String TAG_VALUE
See Also:
Constant Field Values

TAG_TRIGGER

protected static final java.lang.String TAG_TRIGGER
See Also:
Constant Field Values

TAG_SIMPLE

protected static final java.lang.String TAG_SIMPLE
See Also:
Constant Field Values

TAG_CRON

protected static final java.lang.String TAG_CRON
See Also:
Constant Field Values

TAG_JOB_NAME

protected static final java.lang.String TAG_JOB_NAME
See Also:
Constant Field Values

TAG_JOB_GROUP

protected static final java.lang.String TAG_JOB_GROUP
See Also:
Constant Field Values

TAG_START_TIME

protected static final java.lang.String TAG_START_TIME
See Also:
Constant Field Values

TAG_END_TIME

protected static final java.lang.String TAG_END_TIME
See Also:
Constant Field Values

TAG_REPEAT_COUNT

protected static final java.lang.String TAG_REPEAT_COUNT
See Also:
Constant Field Values

TAG_REPEAT_INTERVAL

protected static final java.lang.String TAG_REPEAT_INTERVAL
See Also:
Constant Field Values

TAG_CRON_EXPRESSION

protected static final java.lang.String TAG_CRON_EXPRESSION
See Also:
Constant Field Values

TAG_TIME_ZONE

protected static final java.lang.String TAG_TIME_ZONE
See Also:
Constant Field Values

XSD_DATE_FORMAT

protected static final java.lang.String XSD_DATE_FORMAT
XML Schema dateTime datatype format.

See http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/#dateTime

See Also:
Constant Field Values

DTD_DATE_FORMAT

protected static final java.lang.String DTD_DATE_FORMAT
Legacy DTD version 1.0 date format.

See Also:
Constant Field Values

scheduledJobs

protected java.util.Map scheduledJobs

jobsToSchedule

protected java.util.List jobsToSchedule

calsToSchedule

protected java.util.List calsToSchedule

listenersToSchedule

protected java.util.List listenersToSchedule

validationExceptions

protected java.util.Collection validationExceptions

classLoadHelper

protected ClassLoadHelper classLoadHelper

digester

protected org.apache.commons.digester.Digester digester
Constructor Detail

JobSchedulingDataProcessor

public JobSchedulingDataProcessor(ClassLoadHelper clh,
                                  boolean validating,
                                  boolean validatingSchema)
Constructor for QuartzMetaDataProcessor.

Parameters:
clh - class-loader helper to share with digester.
validating - whether or not to validate XML.
validatingSchema - whether or not to validate XML schema.
Method Detail

initDigester

protected void initDigester(boolean validating,
                            boolean validatingSchema)
Initializes the digester.

Parameters:
validating - whether or not to validate XML.
validatingSchema - whether or not to validate XML schema.

addDefaultDigesterRules

protected void addDefaultDigesterRules(org.apache.commons.digester.Digester digester)
Add the default set of digest rules


addCustomDigesterRules

protected boolean addCustomDigesterRules(org.apache.commons.digester.Digester digester)
Template method provided as a hook for those who wish to extend this class and add more functionality. This method is invoked after the Digester is instantiated, and before the default set of rules are added.

Parameters:
digester -
Returns:
false, if the default rules should NOT be added

initSchemaValidation

protected void initSchemaValidation(boolean validatingSchema)
Initializes the digester for XML Schema validation.

Parameters:
validatingSchema - whether or not to validate XML.

getLog

protected org.apache.commons.logging.Log getLog()

getUseContextClassLoader

public boolean getUseContextClassLoader()
Returns whether to use the context class loader.

Returns:
whether to use the context class loader.

setUseContextClassLoader

public void setUseContextClassLoader(boolean useContextClassLoader)
Sets whether to use the context class loader.

Parameters:
useContextClassLoader - boolean.

getOverWriteExistingJobs

public boolean getOverWriteExistingJobs()
Returns whether to overwrite existing jobs.

Returns:
whether to overwrite existing jobs.

setOverWriteExistingJobs

public void setOverWriteExistingJobs(boolean overWriteExistingJobs)
Sets whether to overwrite existing jobs.

Parameters:
overWriteExistingJobs - boolean.

processFile

public void processFile()
                 throws java.lang.Exception
Process the xml file in the default location (a file named "quartz_jobs.xml" in the current working directory).

Throws:
java.lang.Exception

processFile

public void processFile(java.lang.String fileName)
                 throws java.lang.Exception
Process the xml file named fileName.

Parameters:
fileName - meta data file name.
Throws:
java.lang.Exception

getSystemIdForFileName

protected java.lang.String getSystemIdForFileName(java.lang.String fileName)
For the given fileName, attempt to expand it to its full path for use as a system id.

See Also:
getURL(String), processFile(), processFile(String), processFileAndScheduleJobs(Scheduler, boolean), processFileAndScheduleJobs(String, Scheduler, boolean)

getURL

protected java.net.URL getURL(java.lang.String fileName)
Returns an URL from the fileName as a resource.

Parameters:
fileName - file name.
Returns:
an URL from the fileName as a resource.

processFile

public void processFile(java.lang.String fileName,
                        java.lang.String systemId)
                 throws ValidationException,
                        javax.xml.parsers.ParserConfigurationException,
                        org.xml.sax.SAXException,
                        java.io.IOException,
                        SchedulerException,
                        java.lang.ClassNotFoundException,
                        java.text.ParseException
Process the xmlfile named fileName with the given system ID.

Parameters:
fileName - meta data file name.
systemId - system ID.
Throws:
ValidationException
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException
SchedulerException
java.lang.ClassNotFoundException
java.text.ParseException

processStream

public void processStream(java.io.InputStream stream,
                          java.lang.String systemId)
                   throws ValidationException,
                          javax.xml.parsers.ParserConfigurationException,
                          org.xml.sax.SAXException,
                          java.io.IOException,
                          SchedulerException,
                          java.lang.ClassNotFoundException,
                          java.text.ParseException
Process the xmlfile named fileName with the given system ID.

Parameters:
stream - an input stream containing the xml content.
systemId - system ID.
Throws:
ValidationException
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException
SchedulerException
java.lang.ClassNotFoundException
java.text.ParseException

processFileAndScheduleJobs

public void processFileAndScheduleJobs(Scheduler sched,
                                       boolean overWriteExistingJobs)
                                throws SchedulerException,
                                       java.lang.Exception
Process the xml file in the default location, and schedule all of the jobs defined within it.

Throws:
SchedulerException
java.lang.Exception

processFileAndScheduleJobs

public void processFileAndScheduleJobs(java.lang.String fileName,
                                       Scheduler sched,
                                       boolean overWriteExistingJobs)
                                throws java.lang.Exception
Process the xml file in the given location, and schedule all of the jobs defined within it.

Parameters:
fileName - meta data file name.
Throws:
java.lang.Exception

processFileAndScheduleJobs

public void processFileAndScheduleJobs(java.lang.String fileName,
                                       java.lang.String systemId,
                                       Scheduler sched,
                                       boolean overWriteExistingJobs)
                                throws java.lang.Exception
Process the xml file in the given location, and schedule all of the jobs defined within it.

Parameters:
fileName - meta data file name.
Throws:
java.lang.Exception

scheduleJobs

public void scheduleJobs(java.util.Map jobBundles,
                         Scheduler sched,
                         boolean overWriteExistingJobs)
                  throws java.lang.Exception
Add the Jobs and Triggers defined in the given map of JobSchedulingBundle s to the given scheduler.

Parameters:
jobBundles -
sched -
overWriteExistingJobs -
Throws:
java.lang.Exception

getScheduledJobs

public java.util.Map getScheduledJobs()
Returns a Map of scheduled jobs.

The key is the job name and the value is a JobSchedulingBundle containing the JobDetail and Trigger.

Returns:
a Map of scheduled jobs.

getScheduledJob

public JobSchedulingBundle getScheduledJob(java.lang.String name)
Returns a JobSchedulingBundle for the job name.

Parameters:
name - job name.
Returns:
a JobSchedulingBundle for the job name.

getInputStream

protected java.io.InputStream getInputStream(java.lang.String fileName)
Returns an InputStream from the fileName as a resource.

Parameters:
fileName - file name.
Returns:
an InputStream from the fileName as a resource.

scheduleJob

public void scheduleJob(JobSchedulingBundle job)
                 throws SchedulerException
Schedules a given job and trigger (both wrapped by a JobSchedulingBundle).

Parameters:
job - job wrapper.
Throws:
SchedulerException - if the Job or Trigger cannot be added to the Scheduler, or there is an internal Scheduler error.

addJobToSchedule

public void addJobToSchedule(JobSchedulingBundle job)

addCalendarToSchedule

public void addCalendarToSchedule(CalendarBundle cal)

addListenerToSchedule

public void addListenerToSchedule(JobListener listener)

scheduleJob

public void scheduleJob(JobSchedulingBundle job,
                        Scheduler sched,
                        boolean localOverWriteExistingJobs)
                 throws SchedulerException
Schedules a given job and trigger (both wrapped by a JobSchedulingBundle).

Parameters:
job - job wrapper.
sched - job scheduler.
localOverWriteExistingJobs - locally overwrite existing jobs.
Throws:
SchedulerException - if the Job or Trigger cannot be added to the Scheduler, or there is an internal Scheduler error.

addScheduledJob

protected void addScheduledJob(JobSchedulingBundle job)
Adds a scheduled job.

Parameters:
job - job wrapper.

addCalendar

public void addCalendar(Scheduler sched,
                        CalendarBundle calendarBundle)
                 throws SchedulerException
Adds a calendar.

Parameters:
calendarBundle - calendar bundle.
Throws:
SchedulerException - if the Calendar cannot be added to the Scheduler, or there is an internal Scheduler error.

resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
                                             java.lang.String systemId)
EntityResolver interface.

Allow the application to resolve external entities.

Until quartz.dtd has a public ID, it must resolved as a system ID. Here's the order of resolution (if one fails, continue to the next).

  1. Tries to resolve the systemId with ClassLoader.getResourceAsStream(String).
  2. If the systemId starts with QUARTZ_SYSTEM_ID_PREFIX, then resolve the part after QUARTZ_SYSTEM_ID_PREFIX with ClassLoader.getResourceAsStream(String).
  3. Else try to resolve systemId as a URL.
  4. If systemId has a colon in it, create a new URL
  5. Else resolve systemId as a File and then call File.toURL().

If the publicId does exist, resolve it as a URL. If the publicId is the Quartz public ID, then resolve it locally.

Specified by:
resolveEntity in interface org.xml.sax.EntityResolver
Overrides:
resolveEntity in class org.xml.sax.helpers.DefaultHandler
Parameters:
publicId - The public identifier of the external entity being referenced, or null if none was supplied.
systemId - The system identifier of the external entity being referenced.
Returns:
An InputSource object describing the new input source, or null to request that the parser open a regular URI connection to the system identifier.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
java.io.IOException - A Java-specific IO exception, possibly the result of creating a new InputStream or Reader for the InputSource.

warning

public void warning(org.xml.sax.SAXParseException e)
             throws org.xml.sax.SAXException
ErrorHandler interface. Receive notification of a warning.

Specified by:
warning in interface org.xml.sax.ErrorHandler
Overrides:
warning in class org.xml.sax.helpers.DefaultHandler
Parameters:
e - The error information encapsulated in a SAX parse exception.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

error

public void error(org.xml.sax.SAXParseException e)
           throws org.xml.sax.SAXException
ErrorHandler interface. Receive notification of a recoverable error.

Specified by:
error in interface org.xml.sax.ErrorHandler
Overrides:
error in class org.xml.sax.helpers.DefaultHandler
Parameters:
e - The error information encapsulated in a SAX parse exception.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

fatalError

public void fatalError(org.xml.sax.SAXParseException e)
                throws org.xml.sax.SAXException
ErrorHandler interface. Receive notification of a non-recoverable error.

Specified by:
fatalError in interface org.xml.sax.ErrorHandler
Overrides:
fatalError in class org.xml.sax.helpers.DefaultHandler
Parameters:
e - The error information encapsulated in a SAX parse exception.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

addValidationException

protected void addValidationException(org.xml.sax.SAXException e)
Adds a detected validation exception.

Parameters:
e - SAX exception.

clearValidationExceptions

protected void clearValidationExceptions()
Resets the the number of detected validation exceptions.


maybeThrowValidationException

protected void maybeThrowValidationException()
                                      throws ValidationException
Throws a ValidationException if the number of validationExceptions detected is greater than zero.

Throws:
ValidationException - DTD validation exception.


Copyright © 2011. All Rights Reserved.