Streaming HTML parser

码农软件 · 软件分类 · HTML解析器 · 2019-04-03 14:29:44

软件介绍

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>

 

本文地址:https://codercto.com/soft/d/2773.html

移动应用的设计与开发

移动应用的设计与开发

[美] 弗林 (Brian Fling) / 马晶慧 / 电子工业出版社 / 2010-5 / 59.80元

本书全面介绍了如何在移动设备上设计和开发应用程序。书中从介绍移动产业的生态环境和移动媒体开始,阐述产品策划的方法、产品架构、视觉设计和产品类型的选择,并详细描述了产品实现过程中所用到的一些技术、工具和概念,最后还简单介绍了如何获得利润和降低成本,肯定了iPhone在移动设备发展史上起到的巨大推动作用。本书不仅能让读者了解到移动设计和开发的知识,更重要的是,它揭示了移动开发的代价高昂、标准混乱的根本......一起来看看 《移动应用的设计与开发》 这本书的介绍吧!

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

html转js在线工具
html转js在线工具

html转js在线工具

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换