Gossamer Forum
Home : General : Perl Programming :

sql data structures to xml with perl, anyone?

Quote Reply
sql data structures to xml with perl, anyone?
Hello,

has anyone tried to create xml files from complex sql database structures with Perl?

By complex structures I mean cases where the data is to be combined from several tables, including one-to-many-relationships. For instance:

Table 1:
First_Name
Last_Name
City

Table 2:
Zip_Code
City
Country

Here I'd like to end up with a structure like this in the xml file:
<First_Name>John</First_Name>
<Last_Name>Miller</Last_Name>
<Zip_Code>1234</Zip_Code>
<City>Hometown</City>
<Country>Swaziland</City>


I've used the DBIx::XML_RDB module and it is very effective in creating xml files with simple table structures. But the only place where you can include reliance on several tables seem to be the sql select statement. So I would have to create complex queries, work with table joins, column aliases, and such, and would not be able to do post-processing of the query results before writing them to the xml file. I'm not sure yet whether I would need that actually for my present project, but just in case: has anyone done something similar?

Thanks,
kellner