#include <string>
#include <iostream>
#include <sstream>
#include <htmlcxx/html/ParserDom.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
using namespace std;
using namespace htmlcxx;
int main()
{
std::string strHtml = "<font size=\"-1\" color=#808080>dddddd 加入了对话</font>";
htmlcxx::HTML::ParserDom parser ;
tree<htmlcxx::HTML::Node> dom = parser.parseTree(strHtml) ;
tree<htmlcxx::HTML::Node>::iterator it = dom.begin();
tree<htmlcxx::HTML::Node>::iterator end = dom.end();
for ( ; it != end ; ++ it)
{
std::string strText;
if (it->isComment())
continue ;
if (it->isTag())
{
it->parseAttributes();
if(it->tagName() == "font")
{
std::pair<bool, std::string> Size = it->attribute("size");
std::pair<bool, std::string> Color = it->attribute("color");
std::string strSize = Size.second;
std::string strColor = Color.second;
}
}
}
return 0;
}