com.topologi.diffx.load
Class DOMRecorder

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

public final class DOMRecorder
extends Object
implements XMLRecorder

Loads a DOM documents as a sequence of events.

This class implements the methods Recorder.process(File) and Recorder.process(String) for convenience, but is it much more efficient to feed this recorder directly with a DOM.

This class is not synchronised.

Since:
0.7
Version:
10 May 2010
Author:
Christophe Lauret

Constructor Summary
DOMRecorder()
           
 
Method Summary
 DiffXConfig getConfig()
          Returns the configuration used by this recorder.
 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(Node node)
          Processes the given node and returns the corresponding event sequence.
 EventSequence process(NodeList node)
          Processes the given node list and returns the corresponding event sequence.
 EventSequence process(String xml)
          Runs the recorder on the specified string.
 void setConfig(DiffXConfig config)
          Sets the configuration used by this recorder.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DOMRecorder

public DOMRecorder()
Method Detail

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.

process

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

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
Runs the recorder on the specified string.

Specified by:
process in interface Recorder
Parameters:
xml - The string to process.
Returns:
The recorded sequence of events.
Throws:
LoadingException - If thrown while parsing.

process

public EventSequence process(InputSource is)
                      throws LoadingException
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 while parsing.

process

public EventSequence process(Node node)
                      throws LoadingException
Processes the given node and returns the corresponding event sequence.

Parameters:
node - The W3C DOM node to be processed.
Returns:
The recorded sequence of events.
Throws:
LoadingException - If thrown while parsing.

process

public EventSequence process(NodeList node)
                      throws LoadingException
Processes the given node list and returns the corresponding event sequence.

This method only returns the event sequence from the first node in the node list, if the node list is empty, this method returns an empty sequence.

Parameters:
node - The W3C DOM node to be processed.
Returns:
The recorded sequence of events.
Throws:
LoadingException - If thrown while parsing.