Class CXMLParser

java.lang.Object
com.nt.udc.io.xml.CXMLParser

public class CXMLParser extends Object
This class is used to parse XML input, obtained from a data-source.

Every time a root-element (@see CXMLElement) is encountered, the parser-processor is called upon to process the element. Any errors are reported.

  • Field Details

    • m_debugLevel

      protected static int m_debugLevel
    • m_iLogger

      protected ILogger m_iLogger
      Object implementing ILogger interface - used for logging errors, warnings, etc.
    • m_iParserProcessor

      protected IXMLParserProcessor m_iParserProcessor
      Reference to the object called upon to process root-elements.
    • m_iDataSource

      protected IDataSource m_iDataSource
      This member represents the data source for the XML stream.
    • m_scanner

      protected CXMLScanner m_scanner
      This member represents the lexical analyzer
    • m_crtElement

      protected CXMLElement m_crtElement
      XML Element currently being processed
    • m_elementStack

      protected CXMLElement[] m_elementStack
      Stack of XML Elements. Contains the elements currently being defined
    • m_elementStkIndex

      protected int m_elementStkIndex
      This is the index in the stack of elements.
  • Constructor Details

    • CXMLParser

      public CXMLParser(IDataSource iDataSource, ILogger iLogger) throws Exception
      Parameters:
      iDataSource - - Object implementing IDataSource interface - used for getting characters one by one
      iLogger - - Object implementing ILogger interface - used for logging errors, warnings, etc.
      Throws:
      Exception
    • CXMLParser

      public CXMLParser(IDataSource iDataSource) throws Exception
      Throws:
      Exception
  • Method Details

    • getDebugLevel

      public static final int getDebugLevel()
    • iParserProcessor

      public final IXMLParserProcessor iParserProcessor()
    • getCurrentLine

      public final int getCurrentLine()
    • hasEmptyStack

      public final boolean hasEmptyStack()
    • setDebugLevel

      public static void setDebugLevel(int debugLevel)
    • setIParserProcessor

      public void setIParserProcessor(IXMLParserProcessor iParserProcessor)
    • parse

      public boolean parse()
      This function is used to parse XML input obtained from the data-source.
      Returns:
      true if successful, false otherwise.
    • initScanner

      protected boolean initScanner()
      This function is used to initialize the scanner.
      Returns:
      true if successful, false otherwise
    • error

      protected void error(String fName, String msg)
    • debug

      protected void debug(String fName, String msg)