com.topologi.diffx.load
Class SAXRecorder

java.lang.Object
  extended by com.topologi.diffx.load.SAXRecorder
All Implemented Interfaces:
Recorder, XMLRecorder

public final class SAXRecorder
extends Object
implements XMLRecorder

Records the SAX events in an EventSequence.

It is possible to specify the name of the XML reader implementation class. By default this class will try to use the Crimson parser org.apache.crimson.parser.XMLReaderImpl.

The XML reader implementation must support the following features settings

   http://xml.org/sax/features/validation         => false
   http://xml.org/sax/features/namespaces         => true | false
   http://xml.org/sax/features/namespace-prefixes => true | false
 

Version:
17 October 2006
Author:
Christophe Lauret, Jean-Baptiste Reure

Constructor Summary
SAXRecorder()
           
 
Method Summary
 DiffXConfig getConfig()
          Returns the configuration used by this recorder.
static String getXMLReaderClass()
          Returns the name XMLReader class used by the SAXRecorders.
 EventSequence process(File file)
          Runs the recorder on the specified file.
 EventSequence process(InputSource is)
          Runs the recorder on the specified input source.
 EventSequence process(String xml)
          Runs the recorder on the specified string.
 void setConfig(DiffXConfig config)
          Sets the configuration used by this recorder.
static void setXMLReaderClass(String className)
          Sets the name of the XML reader class to use.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SAXRecorder

public SAXRecorder()
Method Detail

process

public EventSequence process(File file)
                      throws LoadingException,
                             IOException
Runs the recorder on the specified file.

This method will count on the InputSource to guess the correct encoding.

Specified by:
process in interface Recorder
Parameters:
file - The file to process.
Returns:
The recorded sequence of events.
Throws:
LoadingException - If thrown while parsing.
IOException - Should I/O error occur.

process

public EventSequence process(String xml)
                      throws LoadingException,
                             IOException
Runs the recorder on the specified string.

This method is provided for convenience. It is best to only use this method for short strings.

Specified by:
process in interface Recorder
Parameters:
xml - The XML string to process.
Returns:
The recorded sequence of events.
Throws:
LoadingException - If thrown while parsing.
IOException - Should I/O error occur.

process

public EventSequence process(InputSource is)
                      throws LoadingException,
                             IOException
Runs the recorder on the specified input source.

Specified by:
process in interface XMLRecorder
Parameters:
is - The input source.
Returns:
The recorded sequence of events.
Throws:
LoadingException - If thrown whilst parsing.
IOException - Should I/O error occur.

getConfig

public DiffXConfig getConfig()
Returns the configuration used by this recorder.

Returns:
the configuration used by this recorder.

setConfig

public void setConfig(DiffXConfig config)
Sets the configuration used by this recorder.

Parameters:
config - The configuration used by this recorder.

getXMLReaderClass

public static String getXMLReaderClass()
Returns the name XMLReader class used by the SAXRecorders.

Returns:
the name XMLReader class used by the SAXRecorders.

setXMLReaderClass

public static void setXMLReaderClass(String className)
Sets the name of the XML reader class to use.

Use null to reset the XML reader class and use the default XML reader.

A new reader will be created only if the specified class is different from the current one.

Parameters:
className - The name of the XML reader class to use; or null to reset the XML reader.