com.ibm.di.parser
Class DSMLParser

java.lang.Object
  extended by com.ibm.di.parser.ParserImpl
      extended by com.ibm.di.parser.XMLParser
          extended by 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
DSMLParser()
          Constructor
 
Method Summary
 org.w3c.dom.Element createAttribute(Attribute attr)
          Creates Element with the given attribute .
 org.w3c.dom.Element createObjectClass(Attribute attr)
          Creates Element with ObjectClass 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 indent
 org.w3c.dom.Node findNamedElement(org.w3c.dom.NodeList list, java.lang.String name)
          Finds element by name
 java.util.Vector getElementList(org.w3c.dom.Node parent)
          Retrieves children elements
 org.w3c.dom.Node getFirstElement(org.w3c.dom.Node parent)
          Retrieves first child element
 org.w3c.dom.Node getFirstText(org.w3c.dom.Node parent)
          Retrieves first first Text node child
 org.w3c.dom.Node getNextNode(org.w3c.dom.Node node)
          Retrieves the next Node
 java.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 Document
 void initOutput()
          Initializes the output Document
 void initParser()
          This function is called by the connector containing this parser
 void p(java.lang.String s)
          Prints a String
 Entry 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 indent
 Entry 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DSMLParser

public DSMLParser()
Constructor

Method Detail

initParser

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

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

initOutput

public void initOutput()
                throws java.lang.Exception
Initializes the output Document

Overrides:
initOutput in class XMLParser
Throws:
java.lang.Exception - if an error occurs.

initInput

public void initInput()
               throws java.lang.Exception
Initializes the properties from the input Document

Overrides:
initInput in class XMLParser
Throws:
java.lang.Exception - if an error occurs.

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 - NodeList
name - 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 - String
list - NodeList

printNode

public void printNode(java.lang.String indent,
                      org.w3c.dom.Node n)
Prints a node with a given indent

Parameters:
indent - String
n - 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 interface ParserInterface
Overrides:
readEntry in class XMLParser
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 interface ParserInterface
Overrides:
writeEntry in class XMLParser
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 with ObjectClass tag name. Then appends a child Element to it with name oc-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 object
elemValue - 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 interface VersionInfoInterface
Overrides:
getVersion in class XMLParser
Returns:
version information