blob: ac198da6cbd91c8cdc85835a88c3eb7c591696be [file] [log] [blame]
David Sedlák2b626ee2019-06-03 16:40:18 +02001
2
3#ifndef LY_PARSER_YIN_H_
4#define LY_PARSER_YIN_H_
5
6#include <stdio.h>
7#include "log.h"
8#include "xml.h"
9#include "stdlib.h"
10
11enum YIN_ARGUMENT {
12 YIN_ARG_UNKNOWN = 0, /**< parsed argument can not be matched with any known yin argument keyword */
13 YIN_ARG_NAME, /**< argument name */
14 YIN_ARG_TARGET_NODE, /**< argument target-node */
15 YIN_ARG_MODULE, /**< argument module */
16 YIN_ARG_VALUE, /**< argument value */
17 YIN_ARG_TEXT, /**< argument text */
18 YIN_ARG_CONDITION, /**< argument condition */
19 YIN_ARG_URI, /**< argument uri */
20 YIN_ARG_DATE, /**< argument data */
21 YIN_ARG_TAG, /**< argument tag */
22 YIN_ARG_XMLNS, /**< argument xmlns */
David Sedlák68826732019-06-05 10:50:58 +020023 YIN_ARG_NONE, /**< special value to specify no valid argument except xmlns, do not confuse with YIN_ARG_UNKNOWN */
David Sedlák2b626ee2019-06-03 16:40:18 +020024};
25
26/**
27 * @brief Match argument name.
28 *
29 * @param[in] name String representing name.
30 * @param[in] len Lenght of the name.
31 *
32 * @reurn YIN_ARGUMENT value.
33 */
34enum YIN_ARGUMENT match_argument_name(const char *name, size_t len);
35
36/**
37 * @brief Parse content of whole element as text.
38 *
39 * @param[in] xml_ctx Xml context.
40 * @param[in] data Data to read from.
41 * @param[out] value Where content of element should be stored.
42 */
43LY_ERR parse_text_element(struct lyxml_context *xml_ctx, const char **data, const char **value);
44
David Sedlákd9d3a312019-06-04 09:47:10 +020045/**
David Sedlákda63c082019-06-04 13:52:23 +020046 * @brief Parse import element
47 *
48 * @param[in] xml_ctx Xml context.
49 * @param[in] module_prefix Prefix of the module to check prefix collisions.
50 * @param[in, out] data Dta to read from.
51 *
52 */
53LY_ERR yin_parse_import(struct lyxml_context *xml_ctx, const char *module_prefix, const char **data, struct lysp_import **imports);
David Sedlák2b626ee2019-06-03 16:40:18 +020054
55#endif /* LY_PARSER_YIN_H_*/