- 授权协议: BSD
- 开发语言: C/C++
- 操作系统: 跨平台
- 软件首页: http://code.google.com/p/streamhtmlparser/
软件介绍
Streaming HTML parser 是一个 C 语言的 HTML 解析器。
示例代码
#include <stdio.h>
#include <streamhtmlparser/htmlparser.h>
int main(void) {
unsigned int getchar_ret;
htmlparser_ctx *parser = htmlparser_new();
while((getchar_ret = getchar()) != EOF) {
char c = (char)getchar_ret;
/* If we received a '$' character, we output the current tag and attribute
* name to stdout. */
if (c == '$') {
printf("[[ ");
if (htmlparser_tag(parser))
printf("tag=%s ", htmlparser_tag(parser));
if (htmlparser_attr(parser))
printf("attr=%s ", htmlparser_attr(parser));
printf("]]");
/* If we read any other character, we pass it to the parser and echo it to
* stdout. */
} else {
htmlparser_parse_chr(parser, c);
putchar(c);
}
}
}
输入
<html> <body $> <title> $ </title> <a href="$" alt="$"> url </a> </body> </html>
输出
<html> <body [[ tag=body ]]> <title> [[ tag=title ]] </title> <a href="[[ tag=a attr=href ]]" alt="[[ tag=a attr=alt ]]"> url </a> </body> </html>
ACM国际大学生程序设计竞赛题解
赵端阳//袁鹤 / 电子工业 / 2010-6 / 38.00元
《ACM国际大学生程序设计竞赛题解(1)》可以作为高等院校有关专业的本科和大专学生参加国际大学生程序设计竞赛的辅导教材,或者作为高等院校数据结构、C/C++程序设计或算法设计与分析等相关课程的教学参考书。随着各大专院校参加ACM/ICPC热情的高涨,迫切需要有关介绍ACM国际大学生程序设计竞赛题解的书籍。《ACM国际大学生程序设计竞赛题解(1)》根据浙江大学在线题库的前80题,进行了解答(个别特别......一起来看看 《ACM国际大学生程序设计竞赛题解》 这本书的介绍吧!