Skip to contents

Retrieve node, reach or reach and section number from XML project file

Usage

get_xml_node_num_by_name(name, xp = xml2::read_xml(cfg$project$path), cfg)

get_xml_reach_num_by_name(name, xp = xml2::read_xml(cfg$project$path), cfg)

get_xml_section_num_by_name(name, xp = xml2::read_xml(cfg$project$path), cfg)

Arguments

name

character name of the node or reach

xp

A xml_document of the XML project file. Default is the one in the configuration

cfg

a config object. Configuration to use. See loadConfig for details

Value

integer the number of the node, reach, or reach and section in the XML project file

Details

In case of several XML nodes are matching the name, the first one is returned. Providing cfg is not necessary if xp is provided.

Examples

xp <- xml2::read_xml(system.file("sic_project_test1.xml", package = "rsic2"))
get_xml_node_num_by_name("V1-droite", xp)
#> [1] 4
get_xml_reach_num_by_name("Bief3", xp)
#> [1] 3
get_xml_section_num_by_name("dyke", xp)
#> [1] 3 2