reimu/htmlcxx/html/ParserDom.h
2018-07-10 13:54:56 +03:00

38 lines
767 B
C++

#ifndef __HTML_PARSER_DOM_H__
#define __HTML_PARSER_DOM_H__
#include "ParserSax.h"
#include "tree.h"
namespace htmlcxx
{
namespace HTML
{
class ParserDom : public ParserSax
{
public:
ParserDom() {}
~ParserDom() {}
const tree<Node> &parseTree(const std::string &html);
const tree<Node> &getTree()
{ return mHtmlTree; }
protected:
virtual void beginParsing();
virtual void foundTag(Node node, bool isEnd);
virtual void foundText(Node node);
virtual void foundComment(Node node);
virtual void endParsing();
tree<Node> mHtmlTree;
tree<Node>::iterator mCurrentState;
};
std::ostream &operator<<(std::ostream &stream, const tree<HTML::Node> &tr);
} //namespace HTML
} //namespace htmlcxx
#endif