int tagAttrs(HTMLParserEvent &event,
const char *name, int len,
const char *cp);
+ int skipAttribute(HTMLParserEvent &event,
+ const char *cp, int *attr_len,
+ const char **value, int *val_len);
Rep();
~Rep();
int m_verbose;
return i;
}
-static int skipAttribute(const char *cp, int *attr_len,
- const char **value, int *val_len)
+int mp::HTMLParser::Rep::skipAttribute(HTMLParserEvent &event,
+ const char *cp, int *attr_len,
+ const char **value, int *val_len)
{
int i = skipName(cp);
*attr_len = i;
int attr_len;
const char *value;
int val_len;
- int nor = skipAttribute(cp+i, &attr_len, &value, &val_len);
+ int nor = skipAttribute(event, cp+i, &attr_len, &value, &val_len);
i += nor;
if (nor)
{
{
int i = 0;
int close_it = 0;
- while (cp[i] && cp[i] != '>')
+ for (; cp[i] && cp[i] != '/' && cp[i] != '>'; i++)
+ ;
+ if (i > 0)
+ event.text(cp, i);
+ if (cp[i] == '/')
{
- if (cp[i] == '/')
- close_it = 1;
+ close_it = 1;
i++;
}
if (cp[i] == '>')
}
};
-
BOOST_AUTO_TEST_CASE( test_html_parser_1 )
{
try
{
mp::HTMLParser hp;
- const char* html =
+ 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 =
+ const char* expected =
"<html><body><a t1=\"v1\" t2=\"v2\" t3=\"v3\">some text</a>"
- "<hr><table></table><a href=\"x\"/></body></html>";
+ "<hr><table></table ><a href=\"x\"/></body></html>";
MyEvent e;
hp.set_verbose(1);
hp.parse(e, html);