HTML_NODE_ALLOC(3)

NAME
html_node_alloc - allocate a HTML node

SYNOPSIS

#include <slweb/html.h>

struct html_node *html_node_alloc(const char *element);

DESCRIPTION
The html_node_alloc(3) function allocates a struct html_node object, which represents a node in a HTML tree. element is the name of the HTML tag. struct html_node is an opaque object internal to slweb and therefore is not accessible to callers.

RETURN VALUE
On success, an opaque pointer to a struct html_node object is returned. On error, a null pointer is returned, and errno might be set by the internal call to malloc(3).

ERRORS
Refer to malloc(3) for a list of possible errors.

EXAMPLE
A struct html_node object with example as element with no attributes or value would be translated by the HTML serializer to <example/>.

NOTES
Typically, html_node_alloc(3) is used to allocate the root node, whereas children can be appended to it via html_node_add_child(3).

SEE ALSO
html_node_free(3), html_node_set_value(3), html_node_set_value_unescaped(3), html_node_add_attr(3), html_node_add_child(3), html_node_add_sibling(3), slweb_html(7).

COPYRIGHT
Copyright (C) 2023 Xavier Del Campo Romero.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.