com.ibm.di.parser
Class XMLParser

java.lang.Object
  extended by com.ibm.di.parser.ParserImpl
      extended by com.ibm.di.parser.XMLParser
All Implemented Interfaces:
ParserInterface, CheckpointRestartInterface, VersionInfoInterface, ErrorHandler
Direct Known Subclasses:
DSMLParser, SOAPParser

public class XMLParser
extends ParserImpl
implements ErrorHandler, CheckpointRestartInterface

A class reading and writing Entries in XML format.


Field Summary
 NodeList children
           
 int curindex
           
 DocumentBuilder db
           
 String entrytag
           
 Document inputDoc
          If we are reading a document, inputDoc will be available as the xmldom object in JavaScript
 Document outputDoc
          If we are writing a document, outputDoc will be available as the xmldom object in JavaScript
 Element toplevel
           
 Element toplevelInput
           
 boolean useCData
           
 String valuetag
           
 
Fields inherited from class com.ibm.di.parser.ParserImpl
_debug, myConfiguration
 
Fields inherited from interface com.ibm.di.server.CheckpointRestartInterface
RESTART_AFTER, RESTART_BEFORE, RESTART_IN
 
Constructor Summary
XMLParser()
           
 
Method Summary
 void closeParser()
          Close parser and deallocate resources.
 void error(SAXParseException exception)
           
 void fatalError(SAXParseException exception)
           
 void flush()
          Flush any data to the output stream.
 Entry getCheckpointInformation()
          Returns the state information for the parser.
 boolean getOmitXMLDeclaration()
           
 String getVersion()
          Return version information
 void initInput()
           
 void initOutput()
           
 void initParser()
          Perform initialization of parser.
 boolean isCheckpointRestartEnabled(int mode)
          Components that support checkpoint/restart for a specific mode must return TRUE from this method.
 void prepareForRestart(ALState state, Entry restartInfo, int restartPoint)
          Notifies of a restart situation.
 Entry readEntry()
          Constructs the next entry from the data structure read in initially.
 void registerScriptBeans(ScriptEngine se)
          Registers inputDoc or outputDoc as the xmldom object in JavaScript
 void setOmitXMLDeclaration(boolean omit)
           
 void warning(SAXParseException err)
           
 void writeEntry(Entry entry)
          Write an entry to the current output stream
 
Methods inherited from class com.ibm.di.parser.ParserImpl
debug, debugMode, getClassInstance, getContext, getDebug, getInputStream, getOutputStream, getParam, getParser, getReader, getWriter, isDeltaSupported, logmsg, setConfiguration, setContext, setDebug, setInputStream, setInputStream, setInputStream, setOutputStream, setOutputStream, setParam, setParser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inputDoc

public Document inputDoc
If we are reading a document, inputDoc will be available as the xmldom object in JavaScript


outputDoc

public Document outputDoc
If we are writing a document, outputDoc will be available as the xmldom object in JavaScript


toplevel

public Element toplevel

toplevelInput

public Element toplevelInput

children

public NodeList children

curindex

public int curindex

useCData

public boolean useCData

entrytag

public String entrytag

valuetag

public String valuetag

db

public DocumentBuilder db
Constructor Detail

XMLParser

public XMLParser()
Method Detail

registerScriptBeans

public void registerScriptBeans(ScriptEngine se)
                         throws Exception
Registers inputDoc or outputDoc as the xmldom object in JavaScript

Specified by:
registerScriptBeans in interface ParserInterface
Overrides:
registerScriptBeans in class ParserImpl
Parameters:
se - The script engine
Throws:
Exception

initParser

public void initParser()
                throws Exception
Description copied from class: ParserImpl
Perform initialization of parser.

Specified by:
initParser in interface ParserInterface
Overrides:
initParser in class ParserImpl
Throws:
Exception

closeParser

public void closeParser()
                 throws Exception
Description copied from class: ParserImpl
Close parser and deallocate resources. This method closes the input and output streams.

Specified by:
closeParser in interface ParserInterface
Overrides:
closeParser in class ParserImpl
Throws:
Exception

flush

public void flush()
           throws Exception
Description copied from class: ParserImpl
Flush any data to the output stream.

Specified by:
flush in interface ParserInterface
Overrides:
flush in class ParserImpl
Throws:
Exception

initOutput

public void initOutput()
                throws Exception
Throws:
Exception

initInput

public void initInput()
               throws Exception
Throws:
Exception

readEntry

public Entry readEntry()
                throws Exception
Constructs the next entry from the data structure read in initially. If end of data encountered a null value is returned.

Specified by:
readEntry in interface ParserInterface
Returns:
the next Entry
Throws:
Exception

writeEntry

public void writeEntry(Entry entry)
                throws Exception
Description copied from interface: ParserInterface
Write an entry to the current output stream

Specified by:
writeEntry in interface ParserInterface
Parameters:
entry - The entry to write
Throws:
Exception

setOmitXMLDeclaration

public void setOmitXMLDeclaration(boolean omit)

getOmitXMLDeclaration

public boolean getOmitXMLDeclaration()

fatalError

public void fatalError(SAXParseException exception)
Specified by:
fatalError in interface ErrorHandler

error

public void error(SAXParseException exception)
           throws SAXException
Specified by:
error in interface ErrorHandler
Throws:
SAXException

warning

public void warning(SAXParseException err)
             throws SAXException
Specified by:
warning in interface ErrorHandler
Throws:
SAXException

isCheckpointRestartEnabled

public boolean isCheckpointRestartEnabled(int mode)
Components that support checkpoint/restart for a specific mode must return TRUE from this method. If a restart has no meaning for mode then the component should still return TRUE.

Specified by:
isCheckpointRestartEnabled in interface CheckpointRestartInterface
Parameters:
mode - The mode the connector runs in
Returns:
true if checkpoint is supported in mode
See Also:
ServerConstants

getCheckpointInformation

public Entry getCheckpointInformation()
                               throws Exception
Returns the state information for the parser. If for some reason the parser decidies that a restart is impossible it must throw an exception. The method is called immediatly before any component methods are called. If there is no need to save any state information a null value should be returned. For eventhandlers this method is called by the dispatcher routine.

Specified by:
getCheckpointInformation in interface CheckpointRestartInterface
Returns:
The entry the parser needs to do a restart or null if that is not needed.
Throws:
Exception

prepareForRestart

public void prepareForRestart(ALState state,
                              Entry restartInfo,
                              int restartPoint)
                       throws Exception
Notifies of a restart situation. This method is called after the connector has been loaded and before any other method calls are made to the connector.

Specified by:
prepareForRestart in interface CheckpointRestartInterface
Parameters:
restartInfo - The last entry object returned by the connector in the getCheckpointInformation method
state - The ALState object for the AssemblyLine
restartPoint - The relative point where restarting is taking place (e.g. RESTART_BEFORE ...)
Throws:
Exception

getVersion

public String getVersion()
Return version information

Specified by:
getVersion in interface VersionInfoInterface