[sf-perl] Going from XML to SQL

Joseph Brenner doom at kzsu.stanford.edu
Wed Mar 23 19:26:22 PST 2005


Before the last meeting, Rich Morin and Josh Berkus were talking
about the issues involved with translating data structures
between XML to SQL. I just came across something on CPAN that
looks relevent, DBIx::DBStag::Cookbook:

    http://search.cpan.org/~cmungall/DBIx-DBStag-0.06/DBIx/DBStag/Cookbook.pm

    This will give an outline of how to build a normalised
    relational database from XML source data, set up SQL
    templates, issue relational queries that return hierarchical
    results (as XML or as perl objects), and autogenerate a web
    query front end for this data.

    Why would you want to do this? Well, it gives you the full
    power of the relational model and SQL, combined with the
    convenience of representations which allow for the nesting of
    data entities (SQL query results are typically flat relations
    which are inconvenient for complex hierarchical data).

The "Stag" concept is funny... a generalization of XML and sexps:

   http://stag.sourceforge.net/

   Data::Stag

   This perl module is for querying and manipulating complex data
   as recursively nested tag/value pairs (Structured tags or
   Simple Tree aggreggates). Procedural and object-oriented modes
   are supported. Tags can be accessed by autogenerated accessor
   methods.

   XML is a hierarchical data format, so this module can be used
   as an XML parser/writer. Other hierarchical formats are
   supported, including lisp S-Expressions (i.e. SXML) and
   indented-text.



More information about the SanFrancisco-pm mailing list