1
0
Fork
You've already forked CTML
0
A HTML parsing library for c.
  • C 98.4%
  • HTML 0.9%
  • Makefile 0.7%
2025年10月24日 14:45:17 +02:00
chtml.c kind of finished (for now). 2025年10月24日 14:45:17 +02:00
chtml.h kind of finished (for now). 2025年10月24日 14:45:17 +02:00
grammar.txt kind of finished (for now). 2025年10月24日 14:45:17 +02:00
LICENSE kind of finished (for now). 2025年10月24日 14:45:17 +02:00
main.c kind of finished (for now). 2025年10月24日 14:45:17 +02:00
makefile kind of finished (for now). 2025年10月24日 14:45:17 +02:00
page.html kind of finished (for now). 2025年10月24日 14:45:17 +02:00
README.md kind of finished (for now). 2025年10月24日 14:45:17 +02:00

CTML

A HTML parsing library for c.

Usage:

$ make && ./test page.html

Or just copy chtml.c and chtml.h to your project.

Output:

{
 "html" : {
 "children" : [
 "head" : {
 },
 "body" : {
 "children" : [
 "button" : {
 "children" : [
 { "textnode" : "bobabutton" }
 ]
 }
 ]
 }
 ]
 }
}

Additional notes:

  • It requires DOCTYPE to be present.
  • It requires a html root tag.
  • You are responsible for freeing all nodes.
  • Text and elements can be distinguished by name and text pointers in DomNode.