XML::RDB 1.1 review

Download
by rbytes.net on

XML::RDB is a Perl extension to convert XML files into RDB schemas and populate, and unpopulate them

License: Perl Artistic License
File size: 33K
Developer: Mark Trostler
0 stars award from rbytes.net

XML::RDB is a Perl extension to convert XML files into RDB schemas and populate, and unpopulate them. Works with XML Schemas too.

SYNOPSIS

use XML::RDB;

# Give our DB's DSN & username/password
my $rdb = new XML::RDB(config_file => 'db_config');

# Generate RDB Schema
$rdb->make_tables("my_xml_file.xml", "db_schema_output_file");

#
# Now import the generated 'db_schema_output_file' into your DB
# (see t/1.t for an automated way to do this)
#

# Now populate our RDB
my($root_table_name, $primary_key) =
$rdb->populate_tables("my_xml_file.xml");

#
# Your XML file is now in your RDB!!!! Play as desired & when ready:
#
$rdb->unpopulate_tables($root_table_name, $primary_key,
'new_xml_file.xml');


#
# That's all fine & dandy but what if you've got an XML Schema???
#
# the first 2 calls are the same:
$rdb->make_tables("my_xsd_file.xsd", "db_schema_output_file");

#
# don't forget to put 'db_schema_output_file' into your DB!
# then:
my($root_table_name, $primary_key) =
$rdb->populate_tables("my_xsd_file.xsd");

# note we only need the primary key for this next call
$rdb->unpopulate_schema($primary_key, 'fully_formed.xml');

#
# Now you've got 'fully_formed.xml' - pass THAT to make_tables
# & yer golden:
#

$rdb->make_tables("fully_formed.xml", "REAL_RDB_schema");

#
# Now insert REAL_RDB_schema into yer DB & now any XML documents
# conforming to your original XML Schema ('my_xsd_file.xsd') can be
# imported into your schema:
my ($rt, $pk) =
$rdb->populate_tables("xml_doc_conforming_to_my_xsd_file.xml");

# See the 'README' file for a LOT more information...

ABSTRACT

XML::RDB - Perl extension to convert XML files into RDB schemas and populate, and unpopulate them. Works with XML Schemas too. Analyzes relationships within either an XML file or an XML Schema to create RDB tables to hold that document (or any XML document that conforms to the XML Schema).

Requirements:
Perl

XML::RDB 1.1 search tags