diff options
author | Marvin Borner | 2020-11-28 21:15:29 +0100 |
---|---|---|
committer | Marvin Borner | 2020-11-28 21:15:29 +0100 |
commit | 825658894b4192811b4a3fd2f375bb503468d4dc (patch) | |
tree | 31744f7c5dc29ddf637e7f0fed398c979f3d64b6 | |
parent | 24dfdaa72a64f7b1b00f5a0e054ac359fc995c52 (diff) |
Fixed closed self closing tags
-rw-r--r-- | libtxt/html.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libtxt/html.c b/libtxt/html.c index b54577f..794ef95 100644 --- a/libtxt/html.c +++ b/libtxt/html.c @@ -63,7 +63,7 @@ static struct dom *generate_dom(char *data, u32 length) if (err != XML_SUCCESS && err != XML_ERROR_BUFFERDRY) { printf("\nXML parse error: %d\n", err); - return 0; + return NULL; } struct dom *root = new_object("root", NULL); @@ -90,8 +90,13 @@ static struct dom *generate_dom(char *data, u32 length) token->end_pos - token->start_pos); name[token->end_pos - token->start_pos] = '\0'; normalize_tag_name(name); + + if (is_self_closing(name)) + break; + if (!current || !current->parent || strcmp(name, current->tag)) return NULL; + current = current->parent; break; case XML_CHARACTER: |