Description What is xml2relational How to use xml2relational
Transforming a hierarchical XML document into a relational data model.
xml2relational
The xml2relational
package is
designed to 'flatten' XML documents with nested objects into relational
dataframes. xml2relational
takes an XML file as input and converts
it into a set of dataframes (tables). The tables are linked among each
other with foreign keys and can be exported as CSV or ready-to-use SQL code
(CREATE TABLE
for the data model, INSERT INTO
for the data).
xml2relational
First, use
toRelational()
to read in an XML file and to convert into a
relational data model.
This will give you a list of dataframes, one
for each table in the relational data model. Tables are linked by foreign
keys. You can specify the naming convention for the tables' primary and
foreign keys as arguments in toRelational()
.
You can
now export the data structures of the tables (or a selection of tables)
using getCreateSQL()
. It support multiple SQL dialects, and
you also provide syntax and data type information for additional SQL
dialects.
You can also export the data as SQL INSERT
statements with the getInsertSQL()
. If you only want to
export the data as CSV use savetofiles()
to save the
dataframes produced by toRelational()
as comma-separated
files.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.