libyang  5.0.4
libyang is YANG data modelling language parser and toolkit written (and providing API) in C.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data printer flags
Collaboration diagram for Data printer flags:

Macros

#define LYD_PRINT_EMPTY_CONT   0x04
 
#define LYD_PRINT_EMPTY_LEAF_LIST   0x08
 
#define LYD_PRINT_JSON_NO_NESTED_PREFIX   0x0100
 
#define LYD_PRINT_SHRINK   LY_PRINT_SHRINK
 
#define LYD_PRINT_SIBLINGS   0x01
 
#define LYD_PRINT_WD_ALL   0x20
 
#define LYD_PRINT_WD_ALL_TAG   0x40
 
#define LYD_PRINT_WD_EXPLICIT   0x00
 
#define LYD_PRINT_WD_IMPL_TAG   0x80
 
#define LYD_PRINT_WD_MASK   0xF0
 
#define LYD_PRINT_WD_TRIM   0x10
 

Detailed Description

Options to change default behavior of the data printers.

Macro Definition Documentation

#define LYD_PRINT_EMPTY_CONT   0x04

Preserve empty non-presence containers

Definition at line 109 of file printer_data.h.

#define LYD_PRINT_EMPTY_LEAF_LIST   0x08

Print even empty list and leaf-list instances, not possible for every data format (supported only for LYD_JSON).

Definition at line 110 of file printer_data.h.

#define LYD_PRINT_JSON_NO_NESTED_PREFIX   0x0100

Do not print the prefix in JSON data for nested nodes (non-top-level). By nested we mean any node that does not appear in the top-level of a corresponding schema. The printed data do not have the information about the module they belong to. When parsing such data it is important to include this information elsewhere (e.g. for lyd_parse_value_fragment() the module name should be part of the path parameter).

Definition at line 143 of file printer_data.h.

#define LYD_PRINT_SHRINK   LY_PRINT_SHRINK

For text formats, output without indentation and formatting new lines. For LYB format, print only the necessary data (making the output smaller) but even valid data require validation after parsing. The contexts used for printing and parsing shrunk LYB data must be identical (the hash of the context used for printing is stored in the LYB data and checked against the context used for parsing. See ly_ctx_get_modules_hash() for more information about how the context hash is computed and what exactly it means for two contexts to be identical). Use this flag if size matters more than parsing performance.

Definition at line 92 of file printer_data.h.

#define LYD_PRINT_SIBLINGS   0x01

Flag for printing also the (following) sibling nodes of the data node. The flag is not allowed for lyd_print_all() and lyd_print_tree().

Definition at line 89 of file printer_data.h.

#define LYD_PRINT_WD_ALL   0x20

With this option, all the nodes are printed as none of them are considered default

Definition at line 124 of file printer_data.h.

#define LYD_PRINT_WD_ALL_TAG   0x40

Same as LYD_PRINT_WD_ALL but also adds attribute 'default' with value 'true' to all nodes that has its default value. The 'default' attribute has namespace: urn:ietf:params:xml:ns:netconf:default:1.0 and thus the attributes are printed only when the ietf-netconf-with-defaults module is present in libyang context (but in that case this namespace is always printed).

Definition at line 127 of file printer_data.h.

#define LYD_PRINT_WD_EXPLICIT   0x00

Explicit with-defaults mode. Only the data explicitly being present in the data tree are printed, so the implicitly added default nodes are not printed. Note that this is the default value when no WD option is specified.

Definition at line 114 of file printer_data.h.

#define LYD_PRINT_WD_IMPL_TAG   0x80

Same as LYD_PRINT_WD_ALL_TAG but the attributes are added only to the nodes that are not explicitly present in the original data tree despite their value is equal to their default value. There is the same limitation regarding the presence of ietf-netconf-with-defaults module in libyang context.

Definition at line 136 of file printer_data.h.

#define LYD_PRINT_WD_MASK   0xF0

Mask for with-defaults modes

Definition at line 113 of file printer_data.h.

#define LYD_PRINT_WD_TRIM   0x10

Trim mode avoids printing the nodes with the value equal to their default value

Definition at line 121 of file printer_data.h.