Title: | XML Generation from Tables |
---|---|
Description: | Converting structured data from tables into XML format using predefined templates ensures consistency and flexibility, making it ideal for data exchange, reporting, and automated workflows. |
Authors: | Jose Samos [aut, cre] |
Maintainer: | Jose Samos <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.0.0.9000 |
Built: | 2025-02-27 06:28:50 UTC |
Source: | https://github.com/josesamos/tab2xml |
This function validates the structure of a spreadsheet file by checking its sheets, primary keys (PKs), and foreign keys (FKs). If a template file is provided, it also checks the column definitions.
check_tab(file_path, template_path = NULL)
check_tab(file_path, template_path = NULL)
file_path |
Character. Path to the spreadsheet file to be validated. |
template_path |
Character (optional). Path to the template file for validation. If 'NULL', only the sheet structure is checked. |
Logical. Returns "TRUE" but warns of possible errors.
It reads a spreadsheet file (Excel or ODS), processes it using a provided XML template, and generates an XML output file.
sheet2xml(file_path, template_path, xml_path = NULL, optimize = FALSE)
sheet2xml(file_path, template_path, xml_path = NULL, optimize = FALSE)
file_path |
Character. Path to the spreadsheet file to be converted. Supports Excel (.xlsx) and ODS formats. |
template_path |
Character. Path to the XML template file to guide the transformation process. |
xml_path |
Character (optional). Output path for the generated XML file. If NULL, it is considered an XML file with the same name and location as the spreadsheet file. |
optimize |
Boolean. Remove empty nodes from the xml file. |
Character. The file path of the generated XML document.
source_xml <- system.file("extdata", "schema_template.xml", package = "tab2xml") source_xlsx <- system.file("extdata", "schema.xlsx", package = "tab2xml") temp_file1 <- tempfile(fileext = ".xml") sheet2xml(source_xlsx, source_xml, temp_file1) source_ods <- system.file("extdata", "schema.ods", package = "tab2xml") temp_file2 <- tempfile(fileext = ".xml") sheet2xml(source_ods, source_xml, temp_file2)
source_xml <- system.file("extdata", "schema_template.xml", package = "tab2xml") source_xlsx <- system.file("extdata", "schema.xlsx", package = "tab2xml") temp_file1 <- tempfile(fileext = ".xml") sheet2xml(source_xlsx, source_xml, temp_file1) source_ods <- system.file("extdata", "schema.ods", package = "tab2xml") temp_file2 <- tempfile(fileext = ".xml") sheet2xml(source_ods, source_xml, temp_file2)