1234567891011121314151617181920212223242526272829303132333435 |
- /* So we need to define some types to helm us parse an html file.
- How about a struct element for html elements?
- It'll have fields for child element, older and younger siblings.
- Also a pointer to an array of html attributes.
- */
- #include <stdbool.h>
- typedef struct html_attribute * attributeptr;
- typedef struct html_attribute {
- char * name;
- char * contents;
- } attribute;
- typedef struct element * elementptr;
- typedef struct element {
- char * name;
- /* Some elements like, p or title, may have just
- text. So the html element <p>hello</p> will have
- contents = "contents".
- */
- char * contents;
- bool done_parsing;
- elementptr parent;
- elementptr child;
- elementptr older_sibling;
- elementptr younger_sibling;
- attributeptr attribute;
- } element;
- /* typedef struct html_comment { */
- /* char * contents; */
- /* } comment; */
|