com.ibm.di.parser
Class XSLbasedXMLParser

java.lang.Object
  extended by com.ibm.di.parser.ParserImpl
      extended by com.ibm.di.parser.XSLbasedXMLParser
All Implemented Interfaces:
ParserInterface, VersionInfoInterface, ErrorHandler

public class XSLbasedXMLParser
extends ParserImpl
implements ErrorHandler

A class reading and writing Entries in XML format.


Field Summary
 NodeList children
          The children of the document element of the input Document
 int curindex
          Variable containing the current index
 DocumentBuilder db
          The document builder used to build the document
 String entrytag
          Entry tag
 Document inputDoc
          The input Document
 Document outputDoc
          The output Document
 Element toplevelInput
          The document element of the input Document
 boolean useCData
          Whether using CDATASection or TextNode.
 String valuetag
          Value tag
 
Fields inherited from class com.ibm.di.parser.ParserImpl
_debug, myConfiguration
 
Constructor Summary
XSLbasedXMLParser()
          Constructor
 
Method Summary
 void closeParser()
          Closes the parser
 void error(SAXParseException exception)
          Rethrows the given exception
 void fatalError(SAXParseException exception)
          Ignore this since an error is called immediately afterwards
 void flush()
          This function is called when the parser is closing to serialize the in memory DOM tree, for a connector in add/update mode
 boolean getOmitXMLDeclaration()
          Returns whether we omit XML declaration or not.
 String getVersion()
          Version information.
 void initInput()
          This function is called as a part of parser initialization, when the connector having this parser is in Iterator mode
 void initOutput()
          This function is called as a part of parser initialization, when the connector having this parser is in Add mode
 void initParser()
          This function is called by the connector containing this parser
 Entry readEntry()
          Constructs the next entry from the data structure read in initially.
 void registerScriptBeans(ScriptEngine se)
          Registers "static" script variables for input or output Document in the given ScriptEngine with the name "xmldom"
 void setOmitXMLDeclaration(boolean omit)
          Sets whether to omit XML declaration or not.
 void warning(SAXParseException err)
          Logs the given warning
 void writeEntry(Entry entry)
          Constructs the data structure from the next entry read in initially.
 
Methods inherited from class com.ibm.di.parser.ParserImpl
debug, debugMode, getClassInstance, getContext, getDebug, getInputStream, getOutputStream, getParam, getParser, getReader, getWriter, isDeltaSupported, logmsg, querySchema, 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
The input Document


outputDoc

public Document outputDoc
The output Document


toplevelInput

public Element toplevelInput
The document element of the input Document


children

public NodeList children
The children of the document element of the input Document


curindex

public int curindex
Variable containing the current index


useCData

public boolean useCData
Whether using CDATASection or TextNode. Default is CDATASection


entrytag

public String entrytag
Entry tag


valuetag

public String valuetag
Value tag


db

public DocumentBuilder db
The document builder used to build the document

Constructor Detail

XSLbasedXMLParser

public XSLbasedXMLParser()
Constructor

Method Detail

registerScriptBeans

public void registerScriptBeans(ScriptEngine se)
                         throws Exception
Registers "static" script variables for input or output Document in the given ScriptEngine with the name "xmldom"

Specified by:
registerScriptBeans in interface ParserInterface
Overrides:
registerScriptBeans in class ParserImpl
Parameters:
se - ScriptEngine
Throws:
Exception - if an error occurs.

initParser

public void initParser()
                throws Exception
This function is called by the connector containing this parser

Specified by:
initParser in interface ParserInterface
Overrides:
initParser in class ParserImpl
Throws:
Exception - if an error occurs.

closeParser

public void closeParser()
                 throws Exception
Closes the parser

Specified by:
closeParser in interface ParserInterface
Overrides:
closeParser in class ParserImpl
Throws:
Exception - if an error occurs.

flush

public void flush()
           throws Exception
This function is called when the parser is closing to serialize the in memory DOM tree, for a connector in add/update mode

Specified by:
flush in interface ParserInterface
Overrides:
flush in class ParserImpl
Throws:
Exception - if an error occurs

initOutput

public void initOutput()
                throws Exception
This function is called as a part of parser initialization, when the connector having this parser is in Add mode

Throws:
Exception - if an error occurs.

initInput

public void initInput()
               throws Exception
This function is called as a part of parser initialization, when the connector having this parser is in Iterator mode

Throws:
Exception - if an error occurs.

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 - if an error occurs.

writeEntry

public void writeEntry(Entry entry)
                throws Exception
Constructs the data structure from the next entry read in initially.

Specified by:
writeEntry in interface ParserInterface
Parameters:
entry - the next Entry
Throws:
Exception - if an error occurs.

setOmitXMLDeclaration

public void setOmitXMLDeclaration(boolean omit)
Sets whether to omit XML declaration or not.

Parameters:
omit - if true omits XML declaration header in output stream; otherwise does not omit XML declaration;

getOmitXMLDeclaration

public boolean getOmitXMLDeclaration()
Returns whether we omit XML declaration or not.

Returns:
true if omits XML declaration header in output stream; false otherwise.

fatalError

public void fatalError(SAXParseException exception)
Ignore this since an error is called immediately afterwards

Specified by:
fatalError in interface ErrorHandler
Parameters:
exception - SAXParseException

error

public void error(SAXParseException exception)
           throws SAXException
Rethrows the given exception

Specified by:
error in interface ErrorHandler
Parameters:
exception - SAXParseException
Throws:
SAXException

warning

public void warning(SAXParseException err)
             throws SAXException
Logs the given warning

Specified by:
warning in interface ErrorHandler
Parameters:
err - SAXParseException
Throws:
SAXException

getVersion

public String getVersion()
Version information.

Specified by:
getVersion in interface VersionInfoInterface
Returns:
version information