1/*
2 * Copyright 2017, Data61
3 * Commonwealth Scientific and Industrial Research Organisation (CSIRO)
4 * ABN 41 687 119 230.
5 *
6 * This software may be distributed and modified according to the terms of
7 * the BSD 2-Clause license. Note that NO WARRANTY is provided.
8 * See "LICENSE_BSD2.txt" for details.
9 *
10 * @TAG(DATA61_BSD)
11 */
12
13/* Basic XML-related functionality. If this ever grows beyond simple helpers, we should switch to
14 * something more full-featured like libxml2.
15 */
16
17#pragma once
18
19#include <utils/attribute.h>
20
21/**
22 * Print a string, escaping characters that have special meanings in XML.
23 * @param[in] string The string to print.
24 * @param[in] print  A printf analogue to use. Will default to printf if this is NULL.
25 * @param[in] arg    A parameter to pass as the first argument to the print function. Ignored if
26 *                   the print parameter is NULL.
27 * @return The number of characters printed.
28 */
29int utils_put_xml_escape(const char *string,
30                         int (*print)(void *arg, const char *format, ...) FORMAT(printf, 2, 3),
31                         void *arg) NONNULL(1);
32