/*$cb
 *    This file is a part of libopenmhp.
 *
 *    Copyright (C) 2005 Mikko Novaro <miknov@gmail.com>
 *
 *    See main header file (libopenmhp/openmhp.h) for licensing and
 *    contact information.
 $ce*/

#ifndef _HANDLER_HPP_
#define _HANDLER_HPP_

// #include <libxml/parser.h>
#include "element.hpp"
#include <string.h>
#include "parser.hpp"

class cXMLHandler : public cXMLParser {
private:
  xml::cXMLElement *curNode;
public:
  cXMLHandler(const char *filename);
  ~cXMLHandler(void);
  void RunHandler(void);
  void Stop(void);
  xml::cXMLElement *GetRootNode(void);
  /* Get a class instance to represent the given element name. Returns
     an object allocated by "new", which should be deleted after
     use. */
  xml::cXMLElement *GetElement(const char *name);

  // overrides to parser:
  void StartElement(const char *name, const char **attrs);
  void EndElement(const char *name);
  void Characters(const char *ch, int len);
};

#endif
