+class MyEvent : public mp::HTMLParserEvent
+{
+public:
+ std::string out;
+ void openTagStart(const char *tag, int tag_len) {
+ out += "<";
+ out.append(tag, tag_len);
+ }
+
+ void attribute(const char *tag, int tag_len,
+ const char *attr, int attr_len,
+ const char *value, int val_len, const char *sep) {
+ out += " ";
+ out.append(attr, attr_len);
+ if (value)
+ {
+ out += "=";
+ out += sep;
+ out.append(value, val_len);
+ out += sep;
+ }
+ }
+ void anyTagEnd(const char *tag, int tag_len, int close_it) {
+ if (close_it)
+ out += "/";
+ out += ">";
+ }
+ void closeTag(const char *tag, int tag_len) {
+ out += "</";
+ out.append(tag, tag_len);
+ }
+ void text(const char *value, int len) {
+ out.append(value, len);
+ }
+};
+#if 0
+BOOST_AUTO_TEST_CASE( test_html_parser_1 )
+{
+ try
+ {
+ mp::HTMLParser hp;
+ const char* html =
+ "<html><body><a t1=v1 t2='v2' t3=\"v3\">some text</a>"
+ "<hr><table ></table ><a href=\"x\"/></body></html>";
+ const char* expected =
+ "<html><body><a t1=v1 t2='v2' t3=\"v3\">some text</a>"
+ "<hr><table></table ><a href=\"x\"/></body></html>";
+ MyEvent e;
+ hp.set_verbose(0);
+ hp.parse(e, html);
+
+ BOOST_CHECK_EQUAL(std::string(expected), e.out);
+ if (std::string(expected) != e.out)