HTML_NODE_SET_VALUE(3)

NAME
html_node_set_value - set value to a HTML node

SYNOPSIS

#include <slweb/html.h>

int html_node_set_value(struct html_node *n, const char *val);

DESCRIPTION
The html_node_set_value(3) function sets a value to a struct html_node object pointed to by n, previously returned by html_node_alloc(3) or html_node_add_child(3). val is a null-terminated string with the value to be assigned to the node. slweb allocates a copy of the null-terminated string defined by val. As opposed to html_node_set_value_unescaped(3), html_node_set_value(3) escapes characters that could case syntax errors, such as < (LESS-THAN SIGN) being translated to &lt;.

RETURN VALUE
On success, html_node_set_value(3) returns zero. On failure, a negative integer is returned.

EXAMPLE
A struct html_node object with example as tag name and hello as its value and no attributes would be translated by the HTML serializer to:

    <example>hello</example>

ERRORS
No errors are defined.

SEE ALSO
html_node_alloc(3), html_node_free(3), html_node_set_value_unescaped(3), html_node_add_attr(3), slweb_http(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.