|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.di.parser.ParserImpl
com.ibm.di.parser.XMLSaxParser
public class XMLSaxParser
A class reading Entries in XML format. XML Sax Parser doesn't support writing.
This parser uses a SAX2 parser to read an XML document. For every start-tag
read from the input document the parser concatenates this tag name with its
parent tag name into a currentTag value. The currentTag value holds the
path to the current position in the XML document.
When character data is read an attribute is either created or appended to using
the currentTag name and the character data as the value. Data collection is only
done when a group tag is found (e.g. when any of the group tag values are found).
When an end-tag is encountered the parser will first check to see if the currentTag matches
the GroupTag configured for the parser, and if it does, the current entry is added to a
queue which is read by the readEntry() method. Since SAX2 is event driven, this class
creates a thread that performs the XML parsing and notifies the parser class
when an entry is ready for consumption.
The currentTag is composed of tag names concatenate with the "@" character. The GroupTag
specifies which tag-path marks the boundary for an entry. If specified as a string
not starting with an asterix, the tag is checked for equality with the currentTag.
If the GroupTag starts with "*" then the currentTag is checked for containment of
the GroupTag (e.g. "Root@Entry@X" matches "*Root@Entry" but not "Root@Entry").
You can specify multiple group tags by comma-separating the tags (e.g. a,b@x etc)
Field Summary |
---|
Fields inherited from class com.ibm.di.parser.ParserImpl |
---|
_debug, myConfiguration |
Constructor Summary | |
---|---|
XMLSaxParser()
Constructor |
Method Summary | |
---|---|
void |
closeParser()
Stops the Sax Content Handler thread. |
String |
getVersion()
Return version information |
void |
initParser()
Initializes queue object, reads configuration parameters, creates SaxContentHandler thread and starts the thread. |
Entry |
readEntry()
readEntry() uses the queue object to check for new entries provided by the xml-parser thread. |
void |
registerScriptBeans(ScriptEngine se)
Not used |
void |
writeEntry(Entry entry)
Not supported |
Methods inherited from class com.ibm.di.parser.ParserImpl |
---|
debug, debugMode, flush, 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 |
Constructor Detail |
---|
public XMLSaxParser()
Method Detail |
---|
public void registerScriptBeans(ScriptEngine se) throws Exception
registerScriptBeans
in interface ParserInterface
registerScriptBeans
in class ParserImpl
se
- The script engine
Exception
public void initParser() throws Exception
initParser
in interface ParserInterface
initParser
in class ParserImpl
Exception
- if getInputStream() and getReader() both returns null.public void closeParser() throws Exception
closeParser
in interface ParserInterface
closeParser
in class ParserImpl
Exception
public Entry readEntry() throws Exception
Exception
public void writeEntry(Entry entry) throws Exception
entry
- The entry to write
Exception
public String getVersion()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |