OpenNMS API 1.2.3

org.opennms.web.parsers
Class BBParser

java.lang.Object
  extended byorg.opennms.web.parsers.BBParser
Direct Known Subclasses:
EventConfParser

Deprecated. Use a Castor-based parser instead.

public class BBParser
extends java.lang.Object

Bluebird parser for XML. BBParser provides basic XML parsing functionality to parse XML from a file or an input stream. BBParser creates a DOMParser which creates a DOM tree of the XML being parsed. BBParser provides the error handling routines for the DOM parser and provides some methods to traverse the elements of the DOM tree created as a result of the parse. The DOMParser created throws an IOException if the xml file is not found or if the xml does not conform to its DTD. In addition to this, BBParser and its sub-classes can set their own exception messages and throw exceptions if the values read are not what is expected. Sub-classes will need to override the 'processElement()' method and implement their own storage and data getter methods specific to the XML that is being processed

Version:
1.1.1.1
Author:
Sowmya, OpenNMS

Nested Class Summary
private  class BBParser.BBErrorHandler
          Deprecated. The error handler.
 
Field Summary
protected  int ATTRIB_VALUE_PAIR_ERR
          Deprecated. Error number set when a typical parm block does not have both the parm name and value pair as expected
protected  java.lang.String ATTRIB_VALUE_PAIR_ERR_STR
          Deprecated. Error message set when the ATTRIB_VALUE_PAIR error occurs
protected  int EXCEPTION
          Deprecated. Error number set by default when there is an exception
protected  java.lang.StringBuffer m_curElement
          Deprecated. Element currently being processed - will need to be set as the sub-class goes through the DOM tree
protected  int m_errNum
          Deprecated. The error number set when an error is encountered
protected  java.lang.String m_exceptionMsg
          Deprecated. The error message set when an error is encountered
protected  org.xml.sax.InputSource m_inpSource
          Deprecated. Input Stream being parsed
protected  org.apache.xerces.parsers.DOMParser m_parser
          Deprecated. DOM parser that builds the DOM tree
protected  int NULL_VALUE_ERR
          Deprecated. Error number set when the value read is null
protected  java.lang.String NULL_VALUE_ERR_STR
          Deprecated. Error message set when the value read is null
 
Constructor Summary
BBParser()
          Deprecated. Default constructor - creates the DOMParser
 
Method Summary
 java.lang.String getErrorMessage()
          Deprecated. Returns the error message for the parse
 int getErrorNumber()
          Deprecated. Returns the error number for the parse
 void parse()
          Deprecated. Parse the already set 'm_inpSource'
 void parse(org.xml.sax.InputSource inpSource)
          Deprecated. Parses the input stream passed
 void parse(java.io.InputStream inpStream)
          Deprecated. Parses the input stream passed
 void parse(java.lang.String fileName)
          Deprecated. Parse the fileName passed
protected  boolean processDocument(org.w3c.dom.Document doc)
          Deprecated. Process the 'Document' object or the root of the DOM tree
protected  boolean processElement(org.w3c.dom.Element el, boolean isRoot)
          Deprecated. Process an Element.
protected  boolean processNode(org.w3c.dom.Node node)
          Deprecated. Processes a 'Node' object of the DOM tree depending upon the node type
protected  java.lang.String processParmValue(org.w3c.dom.Node parmValueNode)
          Deprecated. Returns the value from a " 2s " type node
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTRIB_VALUE_PAIR_ERR

protected final int ATTRIB_VALUE_PAIR_ERR
Deprecated. 
Error number set when a typical parm block does not have both the parm name and value pair as expected

See Also:
Constant Field Values

NULL_VALUE_ERR

protected final int NULL_VALUE_ERR
Deprecated. 
Error number set when the value read is null

See Also:
Constant Field Values

EXCEPTION

protected final int EXCEPTION
Deprecated. 
Error number set by default when there is an exception

See Also:
Constant Field Values

ATTRIB_VALUE_PAIR_ERR_STR

protected final java.lang.String ATTRIB_VALUE_PAIR_ERR_STR
Deprecated. 
Error message set when the ATTRIB_VALUE_PAIR error occurs

See Also:
Constant Field Values

NULL_VALUE_ERR_STR

protected final java.lang.String NULL_VALUE_ERR_STR
Deprecated. 
Error message set when the value read is null

See Also:
Constant Field Values

m_curElement

protected java.lang.StringBuffer m_curElement
Deprecated. 
Element currently being processed - will need to be set as the sub-class goes through the DOM tree


m_exceptionMsg

protected java.lang.String m_exceptionMsg
Deprecated. 
The error message set when an error is encountered


m_errNum

protected int m_errNum
Deprecated. 
The error number set when an error is encountered


m_parser

protected org.apache.xerces.parsers.DOMParser m_parser
Deprecated. 
DOM parser that builds the DOM tree


m_inpSource

protected org.xml.sax.InputSource m_inpSource
Deprecated. 
Input Stream being parsed

Constructor Detail

BBParser

public BBParser()
Deprecated. 
Default constructor - creates the DOMParser

Method Detail

processDocument

protected boolean processDocument(org.w3c.dom.Document doc)
Deprecated. 
Process the 'Document' object or the root of the DOM tree

Returns:
true if the tree traversal is successful, false otherwise

processNode

protected boolean processNode(org.w3c.dom.Node node)
Deprecated. 
Processes a 'Node' object of the DOM tree depending upon the node type

Returns:
true if the node is read succefully

processElement

protected boolean processElement(org.w3c.dom.Element el,
                                 boolean isRoot)
Deprecated. 
Process an Element. This is the method to be overridden by sub-classes to branch off and go through the DOM tree to handle elements specific to the XML they are parsing - does nothing here

Returns:
true if processed sucessfully, false otherwise

processParmValue

protected java.lang.String processParmValue(org.w3c.dom.Node parmValueNode)
Deprecated. 
Returns the value from a " 2s " type node

Returns:
the value from a " 2s " type node

parse

public void parse()
           throws java.io.IOException
Deprecated. 
Parse the already set 'm_inpSource'

Throws:
java.io.IOException - if parse fails for any reason

parse

public void parse(java.lang.String fileName)
           throws java.io.IOException
Deprecated. 
Parse the fileName passed

Parameters:
fileName - file to be parsed
Throws:
java.io.IOException - if parse fails for any reason

parse

public void parse(java.io.InputStream inpStream)
           throws java.io.IOException
Deprecated. 
Parses the input stream passed

Parameters:
inpStream - the input stream that contains the XML to be parsed
Throws:
java.io.IOException - if parse fails for any reason

parse

public void parse(org.xml.sax.InputSource inpSource)
           throws java.io.IOException
Deprecated. 
Parses the input stream passed

Parameters:
inpSource - the input source that contains the XML to be parsed
Throws:
java.io.IOException - if parse fails for any reason

getErrorNumber

public int getErrorNumber()
Deprecated. 
Returns the error number for the parse

Returns:
zero if no error, otherwise the error number

getErrorMessage

public java.lang.String getErrorMessage()
Deprecated. 
Returns the error message for the parse

Returns:
the error message if an error occurred while parsing

OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.