R/xml_path.R

Defines functions xml_path

Documented in xml_path

#' Retrieve the xpath to a node
#'
#' This is useful when you want to figure out where nodes matching an
#' xpath expression live in a document.
#'
#' @inheritParams xml_name
#' @return A character vector.
#' @export
#' @examples
#' x <- read_xml("<foo><bar><baz /></bar><baz /></foo>")
#' xml_path(xml_find_all(x, ".//baz"))
xml_path <- function(x) {
  .Call(node_path, x)
}
hadley/xml2 documentation built on Jan. 10, 2024, 3:52 p.m.