Skip to main content

lyd_find_xpath

Function lyd_find_xpath 

Source
pub unsafe extern "C" fn lyd_find_xpath(
    ctx_node: *const lyd_node,
    xpath: *const c_char,
    set: *mut *mut ly_set,
) -> Type
Expand description

@brief Search in the given data for instances of nodes matching the provided XPath.

If a list instance is being selected with all its key values specified and ordered in the form list[key1=...][key2=...][key3=...] or a leaf-list instance in the form leaf-list[.=...], these instances are found using hashes with constant (O(1)) complexity (unless they are defined in top-level). Other predicates can still follow the aforementioned ones.

Opaque nodes are part of the evaluation but only those with a matching schema node.

Extension instance data and anyxml/anydata contents are normally traversed and part of the evaluation.

@param[in] ctx_node XPath context node. @param[in] xpath [XPath](@ref howtoXPath) to select in JSON format. It must evaluate into a node set. @param[out] set Set of found data nodes. In case the result is a number, a string, or a boolean, the returned set is empty. @return LY_SUCCESS on success, @p set is returned. @return LY_ERR value if an error occurred.