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

程序员的数学3

程序员的数学3

[日] 平冈和幸、[日] 堀玄 / 卢晓南 / 人民邮电出版社 / 2016-3 / 79.00元

本书沿袭“程序员的数学”系列平易近人的风格,用通俗的语言和具象的图表深入讲解了编程中所需的线性代数知识。内容包括向量、矩阵、行列式、秩、逆矩阵、线性方程、LU分解、特征值、对角化、Jordan标准型、特征值算法等。一起来看看 《程序员的数学3》 这本书的介绍吧!

URL 编码/解码
URL 编码/解码

URL 编码/解码

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

html转js在线工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具