From 5b251deead31272e789db695fc2654de9a59aa8a Mon Sep 17 00:00:00 2001 From: JornGitHub <57216055+JornGitHub@users.noreply.github.com> Date: Wed, 1 May 2024 11:24:42 +0200 Subject: [PATCH] Update get_tableau_data_source.R --- R/get_tableau_data_source.R | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/R/get_tableau_data_source.R b/R/get_tableau_data_source.R index 0ffefb4..7900a1f 100644 --- a/R/get_tableau_data_source.R +++ b/R/get_tableau_data_source.R @@ -15,6 +15,17 @@ #' } get_tableau_data_source <- function(dashboard) { data <- xml2::read_xml(dashboard) - data_source <- xml2::xml_find_all(data, "//@filename") - return(xml2::xml_text(data_source)) + + # Find all nodes with filename attribute + filename_nodes <- xml2::xml_find_all(data, "//@filename") + # Extract text from filename nodes + filename_values <- xml2::xml_text(filename_nodes) + + # Find all nodes with directory attribute + directory_nodes <- xml2::xml_find_all(data, "//@directory") + # Extract text from directory nodes + directory_values <- xml2::xml_text(directory_nodes) + + # Return filename and directory values combined as one file path string + return(path = paste0(directory_values, "/", filename_values)) }