Package com.ibm.di.parser
Class XSLbasedXMLParser
- java.lang.Object
-
- com.ibm.di.parser.ParserImpl
-
- com.ibm.di.parser.XSLbasedXMLParser
-
- All Implemented Interfaces:
ParserInterface,VersionInfoInterface,org.xml.sax.ErrorHandler
public class XSLbasedXMLParser extends ParserImpl implements org.xml.sax.ErrorHandler
A class reading and writing Entries in XML format.
-
-
Field Summary
Fields Modifier and Type Field Description org.w3c.dom.NodeListchildrenThe children of the document element of the input DocumentintcurindexVariable containing the current indexjavax.xml.parsers.DocumentBuilderdbThe document builder used to build the documentjava.lang.StringentrytagEntry tagorg.w3c.dom.DocumentinputDocThe input Documentorg.w3c.dom.DocumentoutputDocThe output Documentorg.w3c.dom.ElementtoplevelInputThe document element of the input DocumentbooleanuseCDataWhether using CDATASection or TextNode.java.lang.StringvaluetagValue tag-
Fields inherited from class com.ibm.di.parser.ParserImpl
_debug, myConfiguration
-
-
Constructor Summary
Constructors Constructor Description XSLbasedXMLParser()Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcloseParser()Closes the parservoiderror(org.xml.sax.SAXParseException exception)Rethrows the given exceptionvoidfatalError(org.xml.sax.SAXParseException exception)Ignore this since an error is called immediately afterwardsvoidflush()This function is called when the parser is closing to serialize the in memory DOM tree, for a connector in add/update modebooleangetOmitXMLDeclaration()Returns whether we omit XML declaration or not.java.lang.StringgetVersion()Version information.voidinitInput()This function is called as a part of parser initialization, when the connector having this parser is in Iterator modevoidinitOutput()This function is called as a part of parser initialization, when the connector having this parser is in Add modevoidinitParser()This function is called by the connector containing this parserEntryreadEntry()Constructs the next entry from the data structure read in initially.voidregisterScriptBeans(ScriptEngine se)Registers "static" script variables for input or output Document in the given ScriptEngine with the name "xmldom"voidsetOmitXMLDeclaration(boolean omit)Sets whether to omit XML declaration or not.voidwarning(org.xml.sax.SAXParseException err)Logs the given warningvoidwriteEntry(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
-
-
-
-
Field Detail
-
inputDoc
public org.w3c.dom.Document inputDoc
The input Document
-
outputDoc
public org.w3c.dom.Document outputDoc
The output Document
-
toplevelInput
public org.w3c.dom.Element toplevelInput
The document element of the input Document
-
children
public org.w3c.dom.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 java.lang.String entrytag
Entry tag
-
valuetag
public java.lang.String valuetag
Value tag
-
db
public javax.xml.parsers.DocumentBuilder db
The document builder used to build the document
-
-
Method Detail
-
registerScriptBeans
public void registerScriptBeans(ScriptEngine se) throws java.lang.Exception
Registers "static" script variables for input or output Document in the given ScriptEngine with the name "xmldom"- Specified by:
registerScriptBeansin interfaceParserInterface- Overrides:
registerScriptBeansin classParserImpl- Parameters:
se- ScriptEngine- Throws:
java.lang.Exception- if an error occurs.
-
initParser
public void initParser() throws java.lang.ExceptionThis function is called by the connector containing this parser- Specified by:
initParserin interfaceParserInterface- Overrides:
initParserin classParserImpl- Throws:
java.lang.Exception- if an error occurs.
-
closeParser
public void closeParser() throws java.lang.ExceptionCloses the parser- Specified by:
closeParserin interfaceParserInterface- Overrides:
closeParserin classParserImpl- Throws:
java.lang.Exception- if an error occurs.
-
flush
public void flush() throws java.lang.ExceptionThis function is called when the parser is closing to serialize the in memory DOM tree, for a connector in add/update mode- Specified by:
flushin interfaceParserInterface- Overrides:
flushin classParserImpl- Throws:
java.lang.Exception- if an error occurs
-
initOutput
public void initOutput() throws java.lang.ExceptionThis function is called as a part of parser initialization, when the connector having this parser is in Add mode- Throws:
java.lang.Exception- if an error occurs.
-
initInput
public void initInput() throws java.lang.ExceptionThis function is called as a part of parser initialization, when the connector having this parser is in Iterator mode- Throws:
java.lang.Exception- if an error occurs.
-
readEntry
public Entry readEntry() throws java.lang.Exception
Constructs the next entry from the data structure read in initially. If end of data encountered a null value is returned.- Specified by:
readEntryin interfaceParserInterface- Returns:
- the next Entry
- Throws:
java.lang.Exception- if an error occurs.
-
writeEntry
public void writeEntry(Entry entry) throws java.lang.Exception
Constructs the data structure from the next entry read in initially.- Specified by:
writeEntryin interfaceParserInterface- Parameters:
entry- the next Entry- Throws:
java.lang.Exception- if an error occurs.
-
setOmitXMLDeclaration
public void setOmitXMLDeclaration(boolean omit)
Sets whether to omit XML declaration or not.- Parameters:
omit- iftrueomits 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:
trueif omits XML declaration header in output stream;falseotherwise.
-
fatalError
public void fatalError(org.xml.sax.SAXParseException exception)
Ignore this since an error is called immediately afterwards- Specified by:
fatalErrorin interfaceorg.xml.sax.ErrorHandler- Parameters:
exception- SAXParseException
-
error
public void error(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXExceptionRethrows the given exception- Specified by:
errorin interfaceorg.xml.sax.ErrorHandler- Parameters:
exception- SAXParseException- Throws:
org.xml.sax.SAXException
-
warning
public void warning(org.xml.sax.SAXParseException err) throws org.xml.sax.SAXExceptionLogs the given warning- Specified by:
warningin interfaceorg.xml.sax.ErrorHandler- Parameters:
err- SAXParseException- Throws:
org.xml.sax.SAXException
-
getVersion
public java.lang.String getVersion()
Version information.- Specified by:
getVersionin interfaceVersionInfoInterface- Returns:
- version information
-
-