Function yaml_document_get_root_node


#include <include/yaml.h>

yaml_node_t * yaml_document_get_root_node(yaml_document_t *document)


Get the root of a YAML document node.

The root object is the first object added to the document.

The pointer returned by this function is valid until any of the functions modifying the documents are called.

An empty document produced by the parser signifies the end of a YAML stream.


[ in ] document - A document object.

the node object or NULL if the document is empty.
Get the root object.


Lines 1179-1188 in src/api.c. Line 881 in include/yaml.h.

YAML_DECLARE(yaml_node_t *)
yaml_document_get_root_node(yaml_document_t *document)
    assert(document);   /* Non-NULL document object is expected. */

    if (document-> != document->nodes.start) {
        return document->nodes.start;
    return NULL;

Add Discussion as Guest

Log in to DocsForge