Package com.ibm.di.parser
Class DSMLParser
- java.lang.Object
-
- com.ibm.di.parser.ParserImpl
-
- com.ibm.di.parser.XMLParser
-
- com.ibm.di.parser.DSMLParser
-
- All Implemented Interfaces:
ParserInterface
,VersionInfoInterface
,org.xml.sax.ErrorHandler
public class DSMLParser extends XMLParser
The DSML Parser reads and writes XML documents. The Parser silently ignores schema entries.
-
-
Field Summary
-
Fields inherited from class com.ibm.di.parser.XMLParser
children, curindex, db, entrytag, inputDoc, outputDoc, toplevel, toplevelInput, useCData, valuetag
-
Fields inherited from class com.ibm.di.parser.ParserImpl
_debug, myConfiguration
-
-
Constructor Summary
Constructors Constructor Description DSMLParser()
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.w3c.dom.Element
createAttribute(Attribute attr)
Creates Element with the given attribute .org.w3c.dom.Element
createObjectClass(Attribute attr)
Creates Element withObjectClass
tag name.org.w3c.dom.Element
createValue(java.lang.String name, java.lang.Object elemValue)
Creates an Element with the given name and elemValue.void
dumpNodes(java.lang.String indent, org.w3c.dom.NodeList list)
Prints all nodes and its children from the given list with the given indentorg.w3c.dom.Node
findNamedElement(org.w3c.dom.NodeList list, java.lang.String name)
Finds element by namejava.util.Vector
getElementList(org.w3c.dom.Node parent)
Retrieves children elementsorg.w3c.dom.Node
getFirstElement(org.w3c.dom.Node parent)
Retrieves first child elementorg.w3c.dom.Node
getFirstText(org.w3c.dom.Node parent)
Retrieves first first Text node childorg.w3c.dom.Node
getNextNode(org.w3c.dom.Node node)
Retrieves the next Nodejava.lang.String
getVersion()
Version Information.java.lang.String
getXML()
Converts the output Document to String using parser's encoding.void
initInput()
Initializes the properties from the input Documentvoid
initOutput()
Initializes the output Documentvoid
initParser()
This function is called by the connector containing this parservoid
p(java.lang.String s)
Prints a StringEntry
parseRequest(java.lang.Object request)
Sets the input stream with the given request object if the object is of type InputStream, Reader or StringReader.void
printNode(java.lang.String indent, org.w3c.dom.Node n)
Prints a node with a given indentEntry
readEntry()
Constructs the next entry from the data structure read in initially.void
writeEntry(Entry entry)
Constructs the data structure from the next entry read in initially.-
Methods inherited from class com.ibm.di.parser.XMLParser
closeParser, error, fatalError, flush, getOmitXMLDeclaration, registerScriptBeans, setOmitXMLDeclaration, warning
-
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
-
-
-
-
Method Detail
-
initParser
public void initParser() throws java.lang.Exception
This function is called by the connector containing this parser- Specified by:
initParser
in interfaceParserInterface
- Overrides:
initParser
in classXMLParser
- Throws:
java.lang.Exception
- if an error occurs.
-
initOutput
public void initOutput() throws java.lang.Exception
Initializes the output Document- Overrides:
initOutput
in classXMLParser
- Throws:
java.lang.Exception
- if an error occurs.
-
initInput
public void initInput() throws java.lang.Exception
Initializes the properties from the input Document
-
parseRequest
public Entry parseRequest(java.lang.Object request) throws java.lang.Exception
Sets the input stream with the given request object if the object is of type InputStream, Reader or StringReader.- Parameters:
request
- Object of type InputStream Reader or StringReader- Returns:
- the next entry
- Throws:
java.lang.Exception
- if an error occurs
-
findNamedElement
public org.w3c.dom.Node findNamedElement(org.w3c.dom.NodeList list, java.lang.String name)
Finds element by name- Parameters:
list
- NodeListname
- String- Returns:
- the Node
-
getElementList
public java.util.Vector getElementList(org.w3c.dom.Node parent)
Retrieves children elements- Parameters:
parent
- Node- Returns:
- the Element children of the given node
-
getFirstElement
public org.w3c.dom.Node getFirstElement(org.w3c.dom.Node parent)
Retrieves first child element- Parameters:
parent
- Node- Returns:
- the first Element child of the given node
-
getFirstText
public org.w3c.dom.Node getFirstText(org.w3c.dom.Node parent)
Retrieves first first Text node child- Parameters:
parent
- Node- Returns:
- the first Text node child of the given node
-
dumpNodes
public void dumpNodes(java.lang.String indent, org.w3c.dom.NodeList list)
Prints all nodes and its children from the given list with the given indent- Parameters:
indent
- Stringlist
- NodeList
-
printNode
public void printNode(java.lang.String indent, org.w3c.dom.Node n)
Prints a node with a given indent- Parameters:
indent
- Stringn
- Node
-
p
public void p(java.lang.String s)
Prints a String- Parameters:
s
- the String to print
-
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:
readEntry
in interfaceParserInterface
- Overrides:
readEntry
in classXMLParser
- Returns:
- the next Entry
- Throws:
java.lang.Exception
- if an error occurs.
-
getNextNode
public org.w3c.dom.Node getNextNode(org.w3c.dom.Node node)
Retrieves the next Node- Parameters:
node
- Node- Returns:
- the next sibling node of the given one
-
writeEntry
public void writeEntry(Entry entry) throws java.lang.Exception
Constructs the data structure from the next entry read in initially.- Specified by:
writeEntry
in interfaceParserInterface
- Overrides:
writeEntry
in classXMLParser
- Parameters:
entry
- the next Entry- Throws:
java.lang.Exception
- if an error occurs.
-
createAttribute
public org.w3c.dom.Element createAttribute(Attribute attr) throws java.lang.Exception
Creates Element with the given attribute .- Parameters:
attr
- Attribute- Returns:
- the created Element
- Throws:
java.lang.Exception
- if an error occurs.
-
createObjectClass
public org.w3c.dom.Element createObjectClass(Attribute attr) throws java.lang.Exception
Creates Element withObjectClass
tag name. Then appends a child Element to it with nameoc-value
and value the given attribute.- Parameters:
attr
- Attribute- Returns:
- the created Element
- Throws:
java.lang.Exception
- if an error occurs.
-
createValue
public org.w3c.dom.Element createValue(java.lang.String name, java.lang.Object elemValue) throws java.lang.Exception
Creates an Element with the given name and elemValue. The type of the Element could be TextNode or CDATASection depending on the type of the elemValue parameter.- Parameters:
name
- String objectelemValue
- value of the Element- Returns:
- the created Element
- Throws:
java.lang.Exception
- if an error occurs.
-
getXML
public java.lang.String getXML() throws java.lang.Exception
Converts the output Document to String using parser's encoding.- Returns:
- the String with the XML Document
- Throws:
java.lang.Exception
- if an error occurs.
-
getVersion
public java.lang.String getVersion()
Version Information.- Specified by:
getVersion
in interfaceVersionInfoInterface
- Overrides:
getVersion
in classXMLParser
- Returns:
- version information
-
-